SearcherFactory
Factory class used by 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:
- Setting a custom scoring model: [IndexSearcher.similarity]
- Parallel per-segment search: [IndexSearcher.IndexSearcher]
- 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 [org.gnit.lucenekmp.index.IndexWriterConfig.setMergedSegmentWarmer] to warm newly merged segments in the background, outside of the reopen path.