public class SearcherFactory extends Object
SearcherManager
to
create new IndexSearchers. The default implementation just creates
an IndexSearcher with no custom behavior:
public IndexSearcher newSearcher(IndexReader r) throws IOException { return new IndexSearcher(r); }You can pass your own factory instead if you want custom behavior, such as:
IndexSearcher.setSimilarity(Similarity)
IndexSearcher.IndexSearcher(IndexReader, Executor)
IndexWriterConfig.setMergedSegmentWarmer(IndexWriter.IndexReaderWarmer)
to warm
newly merged segments in the background, outside of the reopen path.
Constructor and Description |
---|
SearcherFactory() |
Modifier and Type | Method and Description |
---|---|
IndexSearcher |
newSearcher(IndexReader reader,
IndexReader previousReader)
Returns a new IndexSearcher over the given reader.
|
public IndexSearcher newSearcher(IndexReader reader, IndexReader previousReader) throws IOException
reader
- the reader to create a new searcher forpreviousReader
- the reader previously used to create a new searcher.
This can be null
if unknown or if the given reader is the initially opened reader.
If this reader is non-null it can be used to find newly opened segments compared to the new reader to warm
the searcher up before returning.IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.