Class LuceneIndexer
- java.lang.Object
-
- net.ontopia.infoset.fulltext.impl.lucene.LuceneIndexer
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.lucene.index.IndexWriter
writer
-
Constructor Summary
Constructors Constructor Description LuceneIndexer(org.apache.lucene.index.IndexWriter writer)
INTERNAL: Creates an indexer instance that will store its index in the given lucene directory and use the specified token stream analyzer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
INTERNAL: Closes the indexer.void
delete()
INTERNAL: Deletes the index.void
delete(String field, String value)
INTERNAL: Removes all documents with the specified field value from the index.void
flush()
INTERNAL: Flushes all changes done to the index.int
getDocs()
INTERNAL: Returns the number of documents stored in the index.protected org.apache.lucene.document.Document
getDocument(DocumentIF document)
protected org.apache.lucene.document.Field
getField(FieldIF field)
protected org.apache.lucene.document.FieldType
getFieldType(FieldIF field)
protected String
getStringValue(Reader reader)
void
index(DocumentIF document)
INTERNAL: Indexes the specified document.
-
-
-
Method Detail
-
getDocs
public int getDocs() throws IOException
INTERNAL: Returns the number of documents stored in the index.- Throws:
IOException
-
index
public void index(DocumentIF document) throws IOException
Description copied from interface:IndexerIF
INTERNAL: Indexes the specified document. This includes tokenizing, indexing and storing the document fields.- Specified by:
index
in interfaceIndexerIF
- Throws:
IOException
-
delete
public void delete(String field, String value) throws IOException
Description copied from interface:IndexerIF
INTERNAL: Removes all documents with the specified field value from the index. This method should generally be, but is not limited to, used to delete documents by their identity field.- Specified by:
delete
in interfaceIndexerIF
- Throws:
IOException
-
flush
public void flush() throws IOException
Description copied from interface:IndexerIF
INTERNAL: Flushes all changes done to the index. A flushing operation can include actions like persisting changes and optimizing the index.- Specified by:
flush
in interfaceIndexerIF
- Throws:
IOException
-
delete
public void delete() throws IOException
Description copied from interface:IndexerIF
INTERNAL: Deletes the index. The indexer is closed after this method returns. Note that some indexers might not support this operation.- Specified by:
delete
in interfaceIndexerIF
- Throws:
IOException
-
close
public void close() throws IOException
Description copied from interface:IndexerIF
INTERNAL: Closes the indexer. After the indexer has been closed it cannot (generally) be reopened.- Specified by:
close
in interfaceIndexerIF
- Throws:
IOException
-
getDocument
protected org.apache.lucene.document.Document getDocument(DocumentIF document) throws IOException
- Throws:
IOException
-
getField
protected org.apache.lucene.document.Field getField(FieldIF field) throws IOException
- Throws:
IOException
-
getFieldType
protected org.apache.lucene.document.FieldType getFieldType(FieldIF field)
-
getStringValue
protected String getStringValue(Reader reader) throws IOException
- Throws:
IOException
-
-