ccc.plugins.search.lucene
Class SimpleLuceneFS

java.lang.Object
  extended by ccc.plugins.search.lucene.SimpleLuceneFS
All Implemented Interfaces:
Index, Indexer, SimpleLucene

public class SimpleLuceneFS
extends java.lang.Object
implements SimpleLucene

Implementation of SimpleLucene operating on a file system index.

Author:
Civic Computing Ltd.

Constructor Summary
SimpleLuceneFS(java.lang.String indexPath)
          Constructor.
 
Method Summary
 void commitUpdate()
          Commit a transaction.
 void createDocument(java.util.UUID id, ResourcePath path, ResourceName name, java.lang.String title, java.util.Set<java.lang.String> tags, java.lang.String content, java.util.Set<Paragraph> paragraphs)
          Add a document to the search index.
 TextExtractor createExtractor(MimeType mimeType)
          Creates a text extractor for PDF, Word and plain text files.
 SearchResult find(java.lang.String searchTerms, int nofOfResultsPerPage, int pageNo)
          Find the results that match the specified search terms.
 SearchResult find(java.lang.String searchTerms, java.lang.String sort, SortOrder order, int nofOfResultsPerPage, int pageNo)
          Find the results that match the specified search terms.
 void rollbackUpdate()
          Roll back a transaction.
 SearchResult similar(java.lang.String uuid, int nofOfResultsPerPage, int pageNo)
          Find the results that are similar to the specified page.
 void startUpdate()
          Start a transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLuceneFS

public SimpleLuceneFS(java.lang.String indexPath)
Constructor.

Parameters:
indexPath - The path to the index file on disk.
Method Detail

find

public SearchResult find(java.lang.String searchTerms,
                         int nofOfResultsPerPage,
                         int pageNo)
Find the results that match the specified search terms.

Specified by:
find in interface Index
Parameters:
searchTerms - The terms to match.
nofOfResultsPerPage - The number of results to return.
pageNo - The page of results to return (first page has index of 0).
Returns:
The SearchResult object with set entities and total count.

find

public SearchResult find(java.lang.String searchTerms,
                         java.lang.String sort,
                         SortOrder order,
                         int nofOfResultsPerPage,
                         int pageNo)
Find the results that match the specified search terms.

Specified by:
find in interface Index
Parameters:
searchTerms - The terms to match.
sort - The field to sort on.
order - The order of the sort.
nofOfResultsPerPage - The number of results to return.
pageNo - The page of results to return (first page has index of 0).
Returns:
The SearchResult object with set entities and total count.

similar

public SearchResult similar(java.lang.String uuid,
                            int nofOfResultsPerPage,
                            int pageNo)
Find the results that are similar to the specified page.

Specified by:
similar in interface Index
Parameters:
uuid - The UUID of the page to compare.
nofOfResultsPerPage - The number of results to return.
pageNo - The page of results to return (first page has index of 0).
Returns:
The SearchResult object with set entities and total count.

commitUpdate

public void commitUpdate()
Commit a transaction.

Specified by:
commitUpdate in interface Indexer

rollbackUpdate

public void rollbackUpdate()
Roll back a transaction.

Specified by:
rollbackUpdate in interface Indexer

startUpdate

public void startUpdate()
Start a transaction.

Specified by:
startUpdate in interface Indexer

createDocument

public void createDocument(java.util.UUID id,
                           ResourcePath path,
                           ResourceName name,
                           java.lang.String title,
                           java.util.Set<java.lang.String> tags,
                           java.lang.String content,
                           java.util.Set<Paragraph> paragraphs)
Add a document to the search index.

Specified by:
createDocument in interface Indexer
Parameters:
id - The resource's ID.
path - The resource's absolute path.
name - The resource's name.
title - The resource's title.
tags - The resource's tags.
content - The document's content.
paragraphs - The paragraphs of the document.

createExtractor

public TextExtractor createExtractor(MimeType mimeType)
Creates a text extractor for PDF, Word and plain text files.

Specified by:
createExtractor in interface Indexer
Parameters:
mimeType - MimeType used to match the file.
Returns:
TextExtractor for the file or null if no matching found.


Copyright © 2010. All Rights Reserved.