Class ContextIndexSearcher
- java.lang.Object
-
- org.apache.lucene.search.IndexSearcher
-
- org.elasticsearch.search.internal.ContextIndexSearcher
-
public class ContextIndexSearcher extends IndexSearcher
Context-aware extension ofIndexSearcher.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.IndexSearcher
IndexSearcher.LeafSlice
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.IndexSearcher
leafContexts, readerContext
-
-
Constructor Summary
Constructors Constructor Description ContextIndexSearcher(IndexReader reader, Similarity similarity, QueryCache queryCache, QueryCachingPolicy queryCachingPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CollectionStatisticscollectionStatistics(String field)ReturnsCollectionStatisticsfor a field, ornullif the field does not exist (has no indexed terms) This can be overridden for example, to return a field's statistics across a distributed collection.WeightcreateWeight(Query query, ScoreMode scoreMode, float boost)Creates aWeightfor the given query, potentially adding caching if possible and configured.DirectoryReadergetDirectoryReader()Queryrewrite(Query original)Expert: called to re-write queries into primitive queries.protected voidsearch(List<LeafReaderContext> leaves, Weight weight, Collector collector)Lower-level search API.voidsetAggregatedDfs(AggregatedDfs aggregatedDfs)voidsetCheckCancelled(Runnable checkCancelled)Set aRunnablethat will be run on a regular basis while collecting documents.voidsetProfiler(QueryProfiler profiler)TermStatisticstermStatistics(Term term, int docFreq, long totalTermFreq)ReturnsTermStatisticsfor a term.-
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 Detail
-
ContextIndexSearcher
public ContextIndexSearcher(IndexReader reader, Similarity similarity, QueryCache queryCache, QueryCachingPolicy queryCachingPolicy)
-
-
Method Detail
-
setProfiler
public void setProfiler(QueryProfiler profiler)
-
setCheckCancelled
public void setCheckCancelled(Runnable checkCancelled)
Set aRunnablethat will be run on a regular basis while collecting documents.
-
setAggregatedDfs
public void setAggregatedDfs(AggregatedDfs aggregatedDfs)
-
rewrite
public Query rewrite(Query original) throws IOException
Description copied from class:IndexSearcherExpert: called to re-write queries into primitive queries.- Overrides:
rewritein classIndexSearcher- Throws:
IOException
-
createWeight
public Weight createWeight(Query query, ScoreMode scoreMode, float boost) throws IOException
Description copied from class:IndexSearcherCreates aWeightfor the given query, potentially adding caching if possible and configured.- Overrides:
createWeightin classIndexSearcher- Throws:
IOException
-
search
protected void search(List<LeafReaderContext> leaves, Weight weight, Collector collector) throws IOException
Description copied from class:IndexSearcherLower-level search API.LeafCollector.collect(int)is called for every document.
NOTE: this method executes the searches on all given leaves exclusively. To search across all the searchers leaves use
IndexSearcher.leafContexts.- Overrides:
searchin classIndexSearcher- Parameters:
leaves- the searchers leaves to execute the searches onweight- to match documentscollector- to receive hits- Throws:
IOException
-
termStatistics
public TermStatistics termStatistics(Term term, int docFreq, long totalTermFreq) throws IOException
Description copied from class:IndexSearcherReturnsTermStatisticsfor a term.This can be overridden for example, to return a term's statistics across a distributed collection.
- Overrides:
termStatisticsin classIndexSearcherdocFreq- The document frequency of the term. It must be greater or equal to 1.totalTermFreq- The total term frequency.- Returns:
- A
TermStatistics(never null). - Throws:
IOException
-
collectionStatistics
public CollectionStatistics collectionStatistics(String field) throws IOException
Description copied from class:IndexSearcherReturnsCollectionStatisticsfor a field, ornullif the field does not exist (has no indexed terms) This can be overridden for example, to return a field's statistics across a distributed collection.- Overrides:
collectionStatisticsin classIndexSearcher- Throws:
IOException
-
getDirectoryReader
public DirectoryReader getDirectoryReader()
-
-