Module org.apache.lucene.facet
Package org.apache.lucene.facet.taxonomy
Class SearcherTaxonomyManager
java.lang.Object
org.apache.lucene.search.ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
org.apache.lucene.facet.taxonomy.SearcherTaxonomyManager
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class SearcherTaxonomyManager
extends ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
Manages near-real-time reopen of both an IndexSearcher and a TaxonomyReader.
NOTE: If you call DirectoryTaxonomyWriter.replaceTaxonomy(org.apache.lucene.store.Directory)
then you must open a
new SearcherTaxonomyManager
afterwards.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Holds a matched pair ofIndexSearcher
andTaxonomyReader
Nested classes/interfaces inherited from class org.apache.lucene.search.ReferenceManager
ReferenceManager.RefreshListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SearcherFactory
private final long
private final DirectoryTaxonomyWriter
Fields inherited from class org.apache.lucene.search.ReferenceManager
current
-
Constructor Summary
ConstructorsConstructorDescriptionSearcherTaxonomyManager
(IndexReader reader, DirectoryTaxonomyReader taxoReader, SearcherFactory searcherFactory) Creates this from already openedIndexReader
andDirectoryTaxonomyReader
instances.SearcherTaxonomyManager
(IndexWriter writer, boolean applyAllDeletes, SearcherFactory searcherFactory, DirectoryTaxonomyWriter taxoWriter) Expert: creates near-real-time searcher and taxonomy reader from the corresponding writers, controlling whether deletes should be applied.SearcherTaxonomyManager
(IndexWriter writer, SearcherFactory searcherFactory, DirectoryTaxonomyWriter taxoWriter) Creates near-real-time searcher and taxonomy reader from the corresponding writers.SearcherTaxonomyManager
(Directory indexDir, Directory taxoDir, SearcherFactory searcherFactory) Creates search and taxonomy readers over the corresponding directories. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Decrement reference counting on the given reference.protected int
Returns the current reference count of the given reference.Refresh the given reference if needed.protected boolean
Try to increment reference counting on the given reference.Methods inherited from class org.apache.lucene.search.ReferenceManager
acquire, addListener, afterClose, afterMaybeRefresh, close, maybeRefresh, maybeRefreshBlocking, release, removeListener
-
Field Details
-
searcherFactory
-
taxoEpoch
private final long taxoEpoch -
taxoWriter
-
-
Constructor Details
-
SearcherTaxonomyManager
public SearcherTaxonomyManager(IndexWriter writer, SearcherFactory searcherFactory, DirectoryTaxonomyWriter taxoWriter) throws IOException Creates near-real-time searcher and taxonomy reader from the corresponding writers.- Throws:
IOException
-
SearcherTaxonomyManager
public SearcherTaxonomyManager(IndexWriter writer, boolean applyAllDeletes, SearcherFactory searcherFactory, DirectoryTaxonomyWriter taxoWriter) throws IOException Expert: creates near-real-time searcher and taxonomy reader from the corresponding writers, controlling whether deletes should be applied.- Throws:
IOException
-
SearcherTaxonomyManager
public SearcherTaxonomyManager(Directory indexDir, Directory taxoDir, SearcherFactory searcherFactory) throws IOException Creates search and taxonomy readers over the corresponding directories.NOTE: you should only use this constructor if you commit and call
ReferenceManager.maybeRefresh()
in the same thread. Otherwise it could lead to an unsync'dIndexSearcher
andTaxonomyReader
pair.- Throws:
IOException
-
SearcherTaxonomyManager
public SearcherTaxonomyManager(IndexReader reader, DirectoryTaxonomyReader taxoReader, SearcherFactory searcherFactory) throws IOException Creates this from already openedIndexReader
andDirectoryTaxonomyReader
instances. Note that the incoming readers will be closed when you callReferenceManager.close()
.- Throws:
IOException
-
-
Method Details
-
decRef
Description copied from class:ReferenceManager
Decrement reference counting on the given reference.- Specified by:
decRef
in classReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
- Throws:
IOException
- if reference decrement on the given resource failed.
-
tryIncRef
Description copied from class:ReferenceManager
Try to increment reference counting on the given reference. Return true if the operation was successful.- Specified by:
tryIncRef
in classReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
- Throws:
IOException
-
refreshIfNeeded
protected SearcherTaxonomyManager.SearcherAndTaxonomy refreshIfNeeded(SearcherTaxonomyManager.SearcherAndTaxonomy ref) throws IOException Description copied from class:ReferenceManager
Refresh the given reference if needed. Returnsnull
if no refresh was needed, otherwise a new refreshed reference.- Specified by:
refreshIfNeeded
in classReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
- Throws:
IOException
- if the refresh operation failed
-
getRefCount
Description copied from class:ReferenceManager
Returns the current reference count of the given reference.- Specified by:
getRefCount
in classReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
-