Class ContextIndexSearcher
java.lang.Object
org.apache.lucene.search.IndexSearcher
org.elasticsearch.search.internal.ContextIndexSearcher
- All Implemented Interfaces:
Closeable,AutoCloseable,org.elasticsearch.core.Releasable
public class ContextIndexSearcher
extends org.apache.lucene.search.IndexSearcher
implements org.elasticsearch.core.Releasable
Context-aware extension of
IndexSearcher.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.search.IndexSearcher
org.apache.lucene.search.IndexSearcher.LeafSlice -
Field Summary
Fields inherited from class org.apache.lucene.search.IndexSearcher
leafContexts, readerContext -
Constructor Summary
ConstructorsConstructorDescriptionContextIndexSearcher(org.apache.lucene.index.IndexReader reader, org.apache.lucene.search.similarities.Similarity similarity, org.apache.lucene.search.QueryCache queryCache, org.apache.lucene.search.QueryCachingPolicy queryCachingPolicy, boolean wrapWithExitableDirectoryReader) -
Method Summary
Modifier and TypeMethodDescriptionaddQueryCancellation(Runnable action)Add aRunnablethat will be run on a regular basis while accessing documents in the DirectoryReader but also while collecting them and check for query cancellation or timeout.voidclose()org.apache.lucene.search.CollectionStatisticscollectionStatistics(String field)org.apache.lucene.search.WeightcreateWeight(org.apache.lucene.search.Query query, org.apache.lucene.search.ScoreMode scoreMode, float boost)org.apache.lucene.index.DirectoryReaderbooleanvoidremoveQueryCancellation(Runnable action)Remove aRunnablethat checks for query cancellation or timeout which is called while accessing documents in the DirectoryReader but also while collecting them.org.apache.lucene.search.Queryrewrite(org.apache.lucene.search.Query original)voidsearch(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.Weight weight, org.apache.lucene.search.Collector collector)voidsetAggregatedDfs(AggregatedDfs aggregatedDfs)voidsetProfiler(QueryProfiler profiler)org.apache.lucene.search.TermStatisticstermStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq)Methods inherited from class org.apache.lucene.search.IndexSearcher
count, doc, doc, doc, explain, explain, getDefaultQueryCache, getDefaultQueryCachingPolicy, getDefaultSimilarity, getExecutor, getIndexReader, getQueryCache, getQueryCachingPolicy, getSimilarity, getSlices, getTopReaderContext, search, search, search, search, search, searchAfter, searchAfter, searchAfter, setDefaultQueryCache, setDefaultQueryCachingPolicy, setQueryCache, setQueryCachingPolicy, setSimilarity, slices, termStatistics, toString
-
Constructor Details
-
ContextIndexSearcher
public ContextIndexSearcher(org.apache.lucene.index.IndexReader reader, org.apache.lucene.search.similarities.Similarity similarity, org.apache.lucene.search.QueryCache queryCache, org.apache.lucene.search.QueryCachingPolicy queryCachingPolicy, boolean wrapWithExitableDirectoryReader) throws IOException- Throws:
IOException
-
-
Method Details
-
setProfiler
-
addQueryCancellation
Add aRunnablethat will be run on a regular basis while accessing documents in the DirectoryReader but also while collecting them and check for query cancellation or timeout. -
removeQueryCancellation
Remove aRunnablethat checks for query cancellation or timeout which is called while accessing documents in the DirectoryReader but also while collecting them. -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-
hasCancellations
public boolean hasCancellations() -
setAggregatedDfs
-
rewrite
public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query original) throws IOException- Overrides:
rewritein classorg.apache.lucene.search.IndexSearcher- Throws:
IOException
-
createWeight
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.Query query, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException- Overrides:
createWeightin classorg.apache.lucene.search.IndexSearcher- Throws:
IOException
-
search
public void search(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.Weight weight, org.apache.lucene.search.Collector collector) throws IOException- Overrides:
searchin classorg.apache.lucene.search.IndexSearcher- Throws:
IOException
-
termStatistics
public org.apache.lucene.search.TermStatistics termStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq) throws IOException- Overrides:
termStatisticsin classorg.apache.lucene.search.IndexSearcher- Throws:
IOException
-
collectionStatistics
public org.apache.lucene.search.CollectionStatistics collectionStatistics(String field) throws IOException- Overrides:
collectionStatisticsin classorg.apache.lucene.search.IndexSearcher- Throws:
IOException
-
getDirectoryReader
public org.apache.lucene.index.DirectoryReader getDirectoryReader()
-