Package org.apache.lucene.search
Class SearcherFactory
- java.lang.Object
-
- org.apache.lucene.search.SearcherFactory
-
public class SearcherFactory extends java.lang.Object
Factory class used bySearcherManager
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:- Setting a custom scoring model:
IndexSearcher.setSimilarity(Similarity)
- Parallel per-segment search:
IndexSearcher(IndexReader, ExecutorService)
- Return custom subclasses of IndexSearcher (for example that implement distributed scoring)
- Run queries to warm your IndexSearcher before it is used. Note: when using near-realtime search
you may want to also
IndexWriterConfig.setMergedSegmentWarmer(IndexWriter.IndexReaderWarmer)
to warm newly merged segments in the background, outside of the reopen path.
- Setting a custom scoring model:
-
-
Constructor Summary
Constructors Constructor Description SearcherFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexSearcher
newSearcher(IndexReader reader)
Returns a new IndexSearcher over the given reader.
-
-
-
Method Detail
-
newSearcher
public IndexSearcher newSearcher(IndexReader reader) throws java.io.IOException
Returns a new IndexSearcher over the given reader.- Throws:
java.io.IOException
-
-