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
ConstructorDescriptionContextIndexSearcher(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 aRunnable
that 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.void
close()
org.apache.lucene.search.CollectionStatistics
collectionStatistics(String field)
org.apache.lucene.search.Weight
createWeight(org.apache.lucene.search.Query query, org.apache.lucene.search.ScoreMode scoreMode, float boost)
org.apache.lucene.index.DirectoryReader
boolean
void
removeQueryCancellation(Runnable action)
Remove aRunnable
that checks for query cancellation or timeout which is called while accessing documents in the DirectoryReader but also while collecting them.org.apache.lucene.search.Query
rewrite(org.apache.lucene.search.Query original)
void
search(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.Weight weight, org.apache.lucene.search.Collector collector)
void
setAggregatedDfs(AggregatedDfs aggregatedDfs)
void
setProfiler(QueryProfiler profiler)
org.apache.lucene.search.TermStatistics
termStatistics(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 aRunnable
that 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 aRunnable
that 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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:
rewrite
in 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:
createWeight
in 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:
search
in 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:
termStatistics
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
-
collectionStatistics
public org.apache.lucene.search.CollectionStatistics collectionStatistics(String field) throws IOException- Overrides:
collectionStatistics
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
-
getDirectoryReader
public org.apache.lucene.index.DirectoryReader getDirectoryReader()
-