Class LuceneIndexer

java.lang.Object
net.ontopia.infoset.fulltext.impl.lucene.LuceneIndexer
All Implemented Interfaces:
IndexerIF

public class LuceneIndexer extends Object implements IndexerIF
INTERNAL: The Lucene indexer implementation. This indexer uses the Lucene search engine to index documents.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.lucene.index.IndexWriter
     
  • 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

    Modifier and Type
    Method
    Description
    void
    INTERNAL: Closes the indexer.
    void
    INTERNAL: Deletes the index.
    void
    delete(String field, String value)
    INTERNAL: Removes all documents with the specified field value from the index.
    void
    INTERNAL: Flushes all changes done to the index.
    int
    INTERNAL: Returns the number of documents stored in the index.
    protected org.apache.lucene.document.Document
     
    protected org.apache.lucene.document.Field
     
    protected org.apache.lucene.document.FieldType
     
    protected String
     
    void
    index(DocumentIF document)
    INTERNAL: Indexes the specified document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • writer

      protected org.apache.lucene.index.IndexWriter writer
  • Constructor Details

    • LuceneIndexer

      public 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 Details

    • 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 interface IndexerIF
      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 interface IndexerIF
      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 interface IndexerIF
      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 interface IndexerIF
      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 interface IndexerIF
      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