Package org.opensearch.action.search
Class SearchPhaseController
java.lang.Object
org.opensearch.action.search.SearchPhaseController
Controller for the search phase.
- Opensearch.internal:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
The reduced query phase -
Constructor Summary
ConstructorDescriptionSearchPhaseController
(org.opensearch.core.common.io.stream.NamedWriteableRegistry namedWriteableRegistry, Function<SearchSourceBuilder, InternalAggregation.ReduceContextBuilder> requestToAggReduceContextBuilder) -
Method Summary
Modifier and TypeMethodDescriptionaggregateDfs
(Collection<DfsSearchResult> results) 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) merge
(boolean ignoreFrom, SearchPhaseController.ReducedQueryPhase reducedQueryPhase, Collection<? extends SearchPhaseResult> fetchResults, IntFunction<SearchPhaseResult> resultsLookup) Enriches search hits and completion suggestion hits fromsortedDocs
usingfetchResultsArr
, merges suggestions, aggregations and profile results
-
Constructor Details
-
SearchPhaseController
public SearchPhaseController(org.opensearch.core.common.io.stream.NamedWriteableRegistry namedWriteableRegistry, Function<SearchSourceBuilder, InternalAggregation.ReduceContextBuilder> requestToAggReduceContextBuilder)
-
-
Method Details
-
aggregateDfs
-
getLastEmittedDocPerShard
public org.apache.lucene.search.ScoreDoc[] getLastEmittedDocPerShard(SearchPhaseController.ReducedQueryPhase reducedQueryPhase, int numShards) -
fillDocIdsToLoad
public List<Integer>[] 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, Collection<? extends SearchPhaseResult> fetchResults, IntFunction<SearchPhaseResult> resultsLookup) Enriches search hits and completion suggestion hits fromsortedDocs
usingfetchResultsArr
, merges suggestions, aggregations and profile resultsExpects sortedDocs to have top search docs across all shards, optionally followed by top suggest docs for each named completion suggestion ordered by suggestion name
-