| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jalios.jcms.search.LuceneFileSearchEngine
public class LuceneFileSearchEngine
This class is an implementation of FileSearchEngine base on Lucene search engine.
| Field Summary | |
|---|---|
static String | 
CONTENTS_FIELD
Field name for the content of the file  | 
static String | 
FILE_INDEX_DIRECTORY
 | 
static String | 
JALIOS_DATE_FIELD
Field name for the Indexing Date (time in ms)  | 
static String | 
JCMS_PATH_FIELD
Field name for the relative path in jcms, e.g.  | 
static String | 
MODIFIED_FIELD
Field name for the last modified date of the file (time in ms) when it was indexed  | 
static String | 
PATH_FIELD
Field name for the file path (file.getPath()) when it was indexed  | 
static String | 
REVISION
 | 
| Fields inherited from interface com.jalios.util.JaliosConstants | 
|---|
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR | 
| Constructor Summary | |
|---|---|
LuceneFileSearchEngine()
 | 
|
| Method Summary | |
|---|---|
 org.apache.lucene.store.FSDirectory | 
getDirectory()
Returns the lucene directory used by this LuceneFileSearchEngine.  | 
 org.apache.lucene.document.Document | 
getDocument(String filename)
Retrieve the Lucene Document bound to the specified filename.  | 
 int | 
getFileCount()
 | 
 org.apache.lucene.document.Document | 
getLuceneDocument(File file,
                  String content)
Retrieve a new lucene Document for the specified file in preparation of indexing.  | 
 void | 
index(File file,
      org.apache.lucene.document.Document doc)
Add the specified lucene Document to the index.  | 
 boolean | 
isAvailable()
 | 
 void | 
optimize()
Realize a Lucene optimization of the Lucene File Index.  | 
 void | 
remove(File file)
Remove the specified file from the lucene index.  | 
 boolean | 
search(QueryHandler qh,
       HashSet<? extends Publication> pubSet,
       QueryResultSet resultSet)
Perform a full-text search on indexed files  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String REVISION
public static final String FILE_INDEX_DIRECTORY
public static final String PATH_FIELD
public static final String CONTENTS_FIELD
public static final String MODIFIED_FIELD
public static final String JALIOS_DATE_FIELD
public static final String JCMS_PATH_FIELD
| Constructor Detail | 
|---|
public LuceneFileSearchEngine()
                       throws Exception
Exception| Method Detail | 
|---|
public org.apache.lucene.store.FSDirectory getDirectory()
IndexReader.indexExists(Directory).
public boolean isAvailable()
isAvailable in interface FileSearchEnginepublic org.apache.lucene.document.Document getDocument(String filename)
filename - relative file path e.g. "upload/docs/file.txt"
public boolean search(QueryHandler qh,
                      HashSet<? extends Publication> pubSet,
                      QueryResultSet resultSet)
search in interface FileSearchEngineqh - the Queryhandler in which to find search text and search options.pubSet - a HashSet containing all the Publication to search. Publication found will be returned. resultSet - the QueryResultSet that must be filled
        with matching Publication
public int getFileCount()
getFileCount in interface FileSearchEngine
public org.apache.lucene.document.Document getLuceneDocument(File file,
                                                             String content)
file - the File to index (must no be null and file must exists).
        this file MUST be located under the webapp root directory (usually inside the upload directory).content - the content of the file, optionnal.
index(File, Document)index(File, Document)
public void index(File file,
                  org.apache.lucene.document.Document doc)
file - the File to be indexed in lucene
        this file MUST be located under the webapp root directory (usually inside the upload directory).doc - the lucene Document instance build (see getLuceneDocument(File, String)public void remove(File file)
file - the File to be removed from lucene.
        this file MUST be located under the webapp root directory (usually inside the upload directory).public void optimize()
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||