Class TurLuceneInstance

java.lang.Object
com.viglet.turing.lucene.TurLuceneInstance

public class TurLuceneInstance extends Object
Holds the Lucene index state for a single core (index directory). Wraps the IndexWriter, Directory, and provides a refreshable IndexSearcher that always reflects the latest committed documents.
Since:
2026.1
Author:
Alexandre Oliveira
  • Constructor Summary

    Constructors
    Constructor
    Description
    TurLuceneInstance(org.apache.lucene.index.IndexWriter indexWriter, org.apache.lucene.store.Directory directory, Path indexPath, org.apache.lucene.facet.FacetsConfig facetsConfig)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    org.apache.lucene.facet.FacetsConfig
    Returns the FacetsConfig used when building facet-enabled documents.
     
    org.apache.lucene.index.DirectoryReader
    Returns the current DirectoryReader, refreshing it if the index has changed.
    org.apache.lucene.search.IndexSearcher
    Returns an IndexSearcher backed by the latest index state.
    org.apache.lucene.index.IndexWriter
     

    Methods inherited from class Object

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

    • TurLuceneInstance

      public TurLuceneInstance(org.apache.lucene.index.IndexWriter indexWriter, org.apache.lucene.store.Directory directory, Path indexPath, org.apache.lucene.facet.FacetsConfig facetsConfig) throws IOException
      Throws:
      IOException
  • Method Details

    • getSearcher

      public org.apache.lucene.search.IndexSearcher getSearcher() throws IOException
      Returns an IndexSearcher backed by the latest index state. If the underlying index has changed since the last call, the reader is refreshed.
      Throws:
      IOException
    • getReader

      public org.apache.lucene.index.DirectoryReader getReader() throws IOException
      Returns the current DirectoryReader, refreshing it if the index has changed.
      Throws:
      IOException
    • getWriter

      public org.apache.lucene.index.IndexWriter getWriter()
    • getIndexPath

      public Path getIndexPath()
    • getFacetsConfig

      public org.apache.lucene.facet.FacetsConfig getFacetsConfig()
      Returns the FacetsConfig used when building facet-enabled documents.
    • close

      public void close() throws IOException
      Throws:
      IOException