Class 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 Detail

      • writer

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

      • 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 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 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
      • getFieldType

        protected org.apache.lucene.document.FieldType getFieldType​(FieldIF field)