Package org.elasticsearch.action.search
Class SearchPhaseController
- java.lang.Object
-
- org.elasticsearch.action.search.SearchPhaseController
-
public final class SearchPhaseController extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchPhaseController.ReducedQueryPhase
-
Constructor Summary
Constructors Constructor Description SearchPhaseController(java.util.function.Function<java.lang.Boolean,InternalAggregation.ReduceContext> reduceContextFunction)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AggregatedDfs
aggregateDfs(java.util.Collection<DfsSearchResult> results)
com.carrotsearch.hppc.IntArrayList[]
fillDocIdsToLoad(int numShards, org.apache.lucene.search.ScoreDoc[] shardDocs)
Builds an array, with potential null elements, with docs to load.org.apache.lucene.search.ScoreDoc[]
getLastEmittedDocPerShard(SearchPhaseController.ReducedQueryPhase reducedQueryPhase, int numShards)
InternalSearchResponse
merge(boolean ignoreFrom, SearchPhaseController.ReducedQueryPhase reducedQueryPhase, java.util.Collection<? extends SearchPhaseResult> fetchResults, java.util.function.IntFunction<SearchPhaseResult> resultsLookup)
Enriches search hits and completion suggestion hits fromsortedDocs
usingfetchResultsArr
, merges suggestions, aggregations and profile results Expects sortedDocs to have top search docs across all shards, optionally followed by top suggest docs for each named completion suggestion ordered by suggestion nameSearchPhaseController.ReducedQueryPhase
reducedQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest, boolean trackTotalHits)
Reduces the given query results and consumes all aggregations and profile results.SearchPhaseController.ReducedQueryPhase
reducedScrollQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults)
Reduces the given query results and consumes all aggregations and profile results.
-
-
-
Constructor Detail
-
SearchPhaseController
public SearchPhaseController(java.util.function.Function<java.lang.Boolean,InternalAggregation.ReduceContext> reduceContextFunction)
Constructor.- Parameters:
reduceContextFunction
- A function that builds a context for the reduce of anInternalAggregation
-
-
Method Detail
-
aggregateDfs
public AggregatedDfs aggregateDfs(java.util.Collection<DfsSearchResult> results)
-
getLastEmittedDocPerShard
public org.apache.lucene.search.ScoreDoc[] getLastEmittedDocPerShard(SearchPhaseController.ReducedQueryPhase reducedQueryPhase, int numShards)
-
fillDocIdsToLoad
public com.carrotsearch.hppc.IntArrayList[] fillDocIdsToLoad(int numShards, org.apache.lucene.search.ScoreDoc[] shardDocs)
Builds an array, with potential null elements, with docs to load.
-
merge
public InternalSearchResponse merge(boolean ignoreFrom, SearchPhaseController.ReducedQueryPhase reducedQueryPhase, java.util.Collection<? extends SearchPhaseResult> fetchResults, java.util.function.IntFunction<SearchPhaseResult> resultsLookup)
Enriches search hits and completion suggestion hits fromsortedDocs
usingfetchResultsArr
, merges suggestions, aggregations and profile results Expects sortedDocs to have top search docs across all shards, optionally followed by top suggest docs for each named completion suggestion ordered by suggestion name
-
reducedScrollQueryPhase
public SearchPhaseController.ReducedQueryPhase reducedScrollQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults)
Reduces the given query results and consumes all aggregations and profile results.- Parameters:
queryResults
- a list of non-null query shard results
-
reducedQueryPhase
public SearchPhaseController.ReducedQueryPhase reducedQueryPhase(java.util.Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest, boolean trackTotalHits)
Reduces the given query results and consumes all aggregations and profile results.- Parameters:
queryResults
- a list of non-null query shard results
-
-