|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.swfit.core.search.BasicSearchObjectIndex
A BasicSearchObjectIndex is a class that instantiates the
necessary resources needed to call the Lucene IndexWriter.
An important point to remember, is that the Analyzer used to store the data,
must be the same Analyzer used to search the data. For that reason any
BasicSearchObjectIndex created will be stored in a Hashtable.
Jakarta Lucene is a high-performance, full-featured text search engine written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. Jakarta Lucene is an open source project available for free download from Apache Jakarta:
http://jakarta.apache.org/lucene/docs/index.html
All in all this is my effort to understand the underlying structure of Lucene. I assume that there are all sorts of smart things one can do to optimize the searching processes, but I see from the FAQs and tutorials that it is recommended to be on the safe side (better safe than clever).
| Field Summary | |
static java.lang.String |
ANALYZER_STRING
|
static java.lang.String[] |
ANALYZER_STRINGS
|
static org.apache.lucene.analysis.Analyzer[] |
ANALYZERS
Tools for setting an Analyzer from a parameter. |
static java.lang.String |
BSO_CODE
Fields for sorting BasicSearchObjects in lists. |
static java.lang.String |
BSO_NAME
Fields for sorting BasicSearchObjects in lists. |
static java.lang.String |
BSO_TYPE
Fields for sorting BasicSearchObjects in lists. |
static int |
DEFAULT_ANALYZER
|
static int |
SCANDINAVIAN_ANALYZER
|
static int |
STANDARD_ANALYZER
|
| Method Summary | |
void |
allBSOtoIndex(BasicSearchObject handle)
Store a set of BasicSearchObjects in this index. |
org.apache.lucene.document.Document[] |
allDocumentsOfType(BasicSearchObject bso)
Get all the Documents needed to rebuild a list of BasicSearchObjects. |
org.apache.lucene.analysis.Analyzer |
analyzer()
|
static org.apache.lucene.analysis.Analyzer |
analyzer(int analyzer)
|
static int |
analyzer(java.lang.String analyzer)
|
void |
closeReader()
Close a reader to free resources and enable a writer to write new segments. |
void |
closeWriter()
If the writer has the index locked for write, we need to close it to enable the reader to delete docs. |
void |
freeSearcher()
Tells this BasicSearchObjectIndex that it is OK to hand out the searcher again. |
static BasicSearchObjectIndex |
getIndexer(java.io.File index_directory,
org.apache.lucene.analysis.Analyzer analyzer)
Build a BasicSearchObjectIndex with the directory to store the Lucene index in, a parameter code for the Analyzer to use and a set of standard file types. |
static BasicSearchObjectIndex |
getIndexer(java.lang.String index_directory)
Build a BasicSearchObjectIndex with the directory to store the Lucene index in. |
static BasicSearchObjectIndex |
getIndexer(java.lang.String index_directory,
int analyzer)
Build a BasicSearchObjectIndex with the directory to store the Lucene index in and a parameter code for the Analyzer to use. |
org.apache.lucene.search.Searcher |
getSearcher()
Check if the resources are unused, create a searcher if necessary, and hand it out. |
org.apache.lucene.document.Document |
singleDocumentByCode(int code)
Get all the Documents needed to rebuild a list of BasicSearchObjects. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final org.apache.lucene.analysis.Analyzer[] ANALYZERS
An Analyzer should have no state. From the Official Lucene FAQ:
"An Analyzer object is merely a factory for TokenStream objects and in typical implementations it does not have any state so you can create one during program initialization and keep it in a static variable."
The following are tools for configuring the analyzer though the web.xml file.
public static final int STANDARD_ANALYZER
public static final int SCANDINAVIAN_ANALYZER
public static final int DEFAULT_ANALYZER
public static final java.lang.String ANALYZER_STRING
public static final java.lang.String[] ANALYZER_STRINGS
public static final java.lang.String BSO_CODE
public static final java.lang.String BSO_NAME
public static final java.lang.String BSO_TYPE
| Method Detail |
public final org.apache.lucene.analysis.Analyzer analyzer()
public static BasicSearchObjectIndex getIndexer(java.lang.String index_directory)
throws java.io.IOException
BasicSearchObjectIndex with the directory to store the Lucene index in.
Indexes the default set of file types, and uses the StandardAnalyzer.
The method is static, so that all requests for a BasicSearchObjectIndex first
checks if one exist for that directory, before a new instance is created.
index_directory - the File to store the index in.BasicSearchObjectIndex corresponding to the given directory.
public static BasicSearchObjectIndex getIndexer(java.lang.String index_directory,
int analyzer)
throws java.io.IOException
Analyzer to use. Will index the standard file types.
The method is static, so that all requests for a BasicSearchObjectIndex first
checks if one exist for that directory.
index_directory - the File to store the index in.analyzer_type - the Analyzer type as a String.BasicSearchObjectIndex corresponding to the given directory.
public static final BasicSearchObjectIndex getIndexer(java.io.File index_directory,
org.apache.lucene.analysis.Analyzer analyzer)
throws java.io.IOException
Analyzer to use and a set of standard file types.
The method is static, so that all requests for a BasicSearchObjectIndex first
checks if one exist for that directory.
index_directory - the File to store the index in.analyzer - the Analyzer to use while indexing.file_types - the array of Strings denoting the file types to index.BasicSearchObjectIndex corresponding to the given directory.public static final org.apache.lucene.analysis.Analyzer analyzer(int analyzer)
public static final int analyzer(java.lang.String analyzer)
public final org.apache.lucene.search.Searcher getSearcher()
throws java.io.IOException,
java.lang.InterruptedException
Searcher corresponding to this index.public final void freeSearcher()
public final void closeReader()
throws java.io.IOException
public final void closeWriter()
throws java.io.IOException
public final void allBSOtoIndex(BasicSearchObject handle)
throws java.lang.InterruptedException,
java.io.IOException
public final org.apache.lucene.document.Document[] allDocumentsOfType(BasicSearchObject bso)
throws java.lang.InterruptedException,
java.io.IOException
public final org.apache.lucene.document.Document singleDocumentByCode(int code)
throws java.lang.InterruptedException,
java.io.IOException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||