|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mayo.informatics.indexer.api.IndexerService
public class IndexerService
This class will sit on top of multiple indexes, and manage them for you.
Constructor Summary | |
---|---|
IndexerService(java.lang.String rootLocation)
Create an indexer service on a directory. |
|
IndexerService(java.lang.String rootLocation,
boolean configureLog4j)
Create an indexer service on a directory. |
Method Summary | |
---|---|
void |
addDocument(java.lang.String indexName,
org.apache.lucene.document.Document document)
Add a document to the index. |
void |
addDocument(java.lang.String indexName,
org.apache.lucene.document.Document document,
org.apache.lucene.analysis.Analyzer analyzer)
Add a document to the index. |
void |
closeBatchRemover(java.lang.String indexName)
Closes the currently open IndexReader. |
void |
closeWriter(java.lang.String indexName)
Closes the currently open Index. |
void |
createIndex(java.lang.String indexName)
Create a new index, using a default analyzer, and no stopwords. |
void |
createIndex(java.lang.String indexName,
org.apache.lucene.analysis.Analyzer analyzer)
Create a new index, using a user specified analyzer. |
void |
createIndex(java.lang.String indexName,
java.lang.String[] stopwords)
Create a new index, using the default analyzer, and your supplied stopwords. |
void |
deleteIndex(java.lang.String indexName)
Delete an index from this indexerService. |
void |
forceUnlockIndex(java.lang.String indexName)
|
SearchServiceInterface |
getIndexSearcher(java.lang.String indexName)
|
SearchServiceInterface |
getIndexSearcher(java.lang.String[] indexNames,
boolean parallelSearch)
|
SearchServiceInterface |
getIndexSearcher(java.lang.String[] indexNames,
boolean useInMemoryIndex,
boolean parallelSearch)
|
SearchServiceInterface |
getIndexSearcher(java.lang.String indexName,
boolean useInMemoryIndex)
|
LuceneIndexReader |
getLuceneIndexReader(java.lang.String indexName)
|
LuceneIndexReader |
getLuceneIndexReader(java.lang.String indexName,
boolean useInMemoryIndex)
|
MetaData |
getMetaData()
|
java.lang.String |
getRootLocation()
|
java.lang.String[] |
listIndexes()
List all of the indexes in this indexservice. |
void |
openBatchRemover(java.lang.String indexName)
Opens a reader on the index. |
void |
openBatchWriter(java.lang.String indexName,
boolean clearContents,
boolean useRAMIndexer)
Opens a new batchIndexWriter. |
void |
openWriter(java.lang.String indexName,
boolean clearContents)
Opens an index writer. |
void |
optimizeIndex(java.lang.String indexName)
Run the low level lucene optimize command on an index. |
void |
refreshAvailableIndexes()
|
int |
removeDocument(java.lang.String indexName,
java.lang.String documentIdentifier)
Use this method to remove a document from an index. |
int |
removeDocument(java.lang.String indexName,
java.lang.String field,
java.lang.String fieldValue)
This will remove all documents from an index where fieldValue = field. |
void |
setDocsPerTempIndex(java.lang.String indexName,
int docs)
How many documents to write out per temporary index. |
void |
setMaxBufferedDocs(java.lang.String indexName,
int docs)
How many documents to buffer before merging. |
void |
setMaxFieldLength(java.lang.String indexName,
int size)
Lucene will truncate fields longer than this. |
void |
setMaxMergeDocs(java.lang.String indexName,
int docs)
See the lucene documentation. |
void |
setMergeFactor(java.lang.String indexName,
int mergeFactor)
How many documents to add in memory before writing to the index. |
void |
setUseCompoundFile(java.lang.String indexName,
boolean bool)
Whether or not to use the new compound file format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IndexerService(java.lang.String rootLocation, boolean configureLog4j) throws InternalErrorException
rootLocation
- The directory where all of your indexes are locatedconfigureLog4j
- Whether or not to configure a log4j appender.
InternalErrorException
public IndexerService(java.lang.String rootLocation) throws InternalErrorException
rootLocation
- The directory where all of your indexes are located
InternalErrorException
Method Detail |
---|
public void refreshAvailableIndexes() throws InternalErrorException
InternalErrorException
public void createIndex(java.lang.String indexName, java.lang.String[] stopwords)
indexName
- Name of index - will match folder name created to hold itstopwords
- Words not to indexpublic void createIndex(java.lang.String indexName)
indexName
- Name of index - will match folder name created to hold itpublic void createIndex(java.lang.String indexName, org.apache.lucene.analysis.Analyzer analyzer)
indexName
- Name of index - will match folder name created to hold itanalyzer
- The analyzer to use while creating the index. See the Lucene
Documentation.public void deleteIndex(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
indexName
-
IndexNotFoundException
InternalIndexerErrorException
public void openBatchWriter(java.lang.String indexName, boolean clearContents, boolean useRAMIndexer) throws IndexNotFoundException, IndexWriterAlreadyOpenException, InternalIndexerErrorException
indexName
- clearContents
- true erases current content, false appends.useRAMIndexer
- true for a ram indexer, false for a file system indexer
IndexNotFoundException
IndexWriterAlreadyOpenException
InternalIndexerErrorException
public void openWriter(java.lang.String indexName, boolean clearContents) throws IndexNotFoundException, IndexWriterAlreadyOpenException, InternalIndexerErrorException
indexName
- clearContents
- True erases the current index. False appends to it.
IndexNotFoundException
IndexWriterAlreadyOpenException
InternalIndexerErrorException
public void closeWriter(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
indexName
-
IndexNotFoundException
InternalIndexerErrorException
public void closeBatchRemover(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
indexName
-
IndexNotFoundException
InternalIndexerErrorException
public void openBatchRemover(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
indexName
- The index to open
IndexNotFoundException
InternalIndexerErrorException
public void addDocument(java.lang.String indexName, org.apache.lucene.document.Document document) throws IndexNotFoundException, InternalIndexerErrorException, DocumentMissingUniqueDocumentIdentifierException
indexName
- The index to add the document to.document
- The document to add
IndexNotFoundException
InternalIndexerErrorException
IndexWriterNotOpenException
DocumentMissingUniqueDocumentIdentifierException
public void optimizeIndex(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
indexName
-
IndexNotFoundException
InternalIndexerErrorException
public void addDocument(java.lang.String indexName, org.apache.lucene.document.Document document, org.apache.lucene.analysis.Analyzer analyzer) throws IndexNotFoundException, InternalIndexerErrorException, DocumentMissingUniqueDocumentIdentifierException
indexName
- The index to add the document to.document
- The document to addanalyzer
- The analyzer to use
IndexNotFoundException
InternalIndexerErrorException
IndexWriterNotOpenException
DocumentMissingUniqueDocumentIdentifierException
public int removeDocument(java.lang.String indexName, java.lang.String documentIdentifier) throws IndexNotFoundException, InternalIndexerErrorException, OperatorErrorException
indexName
- documentIdentifier
- The document identifier that was used to add the document.
IndexNotFoundException
IndexReaderNotOpenException
InternalIndexerErrorException
OperatorErrorException
public int removeDocument(java.lang.String indexName, java.lang.String field, java.lang.String fieldValue) throws IndexNotFoundException, InternalIndexerErrorException, OperatorErrorException
indexName
- The index to remove from.field
- The field to look for.fieldValue
- The value to match.
IndexNotFoundException
IndexReaderNotOpenException
InternalIndexerErrorException
OperatorErrorException
public java.lang.String[] listIndexes()
public SearchServiceInterface getIndexSearcher(java.lang.String[] indexNames, boolean parallelSearch) throws InternalIndexerErrorException, IndexNotFoundException
InternalIndexerErrorException
IndexNotFoundException
public SearchServiceInterface getIndexSearcher(java.lang.String[] indexNames, boolean useInMemoryIndex, boolean parallelSearch) throws InternalIndexerErrorException, IndexNotFoundException
InternalIndexerErrorException
IndexNotFoundException
public LuceneIndexReader getLuceneIndexReader(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
IndexNotFoundException
InternalIndexerErrorException
public LuceneIndexReader getLuceneIndexReader(java.lang.String indexName, boolean useInMemoryIndex) throws IndexNotFoundException, InternalIndexerErrorException
IndexNotFoundException
InternalIndexerErrorException
public SearchServiceInterface getIndexSearcher(java.lang.String indexName) throws InternalIndexerErrorException, IndexNotFoundException
InternalIndexerErrorException
IndexNotFoundException
public SearchServiceInterface getIndexSearcher(java.lang.String indexName, boolean useInMemoryIndex) throws InternalIndexerErrorException, IndexNotFoundException
InternalIndexerErrorException
IndexNotFoundException
public java.lang.String getRootLocation()
public void forceUnlockIndex(java.lang.String indexName) throws IndexNotFoundException, InternalIndexerErrorException
IndexNotFoundException
InternalIndexerErrorException
public MetaData getMetaData()
public void setDocsPerTempIndex(java.lang.String indexName, int docs) throws IndexNotFoundException, OperatorErrorException
indexName
- docs
-
IndexNotFoundException
OperatorErrorException
public void setMaxBufferedDocs(java.lang.String indexName, int docs) throws IndexNotFoundException, OperatorErrorException
indexName
- docs
-
IndexNotFoundException
OperatorErrorException
public void setMaxFieldLength(java.lang.String indexName, int size) throws IndexNotFoundException, OperatorErrorException
indexName
- size
-
IndexNotFoundException
OperatorErrorException
public void setMaxMergeDocs(java.lang.String indexName, int docs) throws IndexNotFoundException, OperatorErrorException
indexName
- docs
-
IndexNotFoundException
OperatorErrorException
public void setMergeFactor(java.lang.String indexName, int mergeFactor) throws IndexNotFoundException, OperatorErrorException
indexName
- mergeFactor
-
IndexNotFoundException
OperatorErrorException
public void setUseCompoundFile(java.lang.String indexName, boolean bool) throws IndexNotFoundException, OperatorErrorException
indexName
- bool
-
IndexNotFoundException
OperatorErrorException
|
Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |