Class RerankingQueryPhaseRankShardContext

java.lang.Object
org.elasticsearch.search.rank.context.QueryPhaseRankShardContext
org.elasticsearch.search.rank.rerank.RerankingQueryPhaseRankShardContext

public class RerankingQueryPhaseRankShardContext extends QueryPhaseRankShardContext
The RerankingQueryPhaseRankShardContext is responsible for combining the different shard-level query results, and then pack them to a RankFeatureShardResult to return to the coordinator. If a document is found in more than one queries, we only keep the max score for that document. This is to be treated with care, as different queries might have different score ranges that could affect the final ranking.
  • Constructor Details

    • RerankingQueryPhaseRankShardContext

      public RerankingQueryPhaseRankShardContext(List<org.apache.lucene.search.Query> queries, int windowSize)
  • Method Details

    • combineQueryPhaseResults

      public RankShardResult combineQueryPhaseResults(List<org.apache.lucene.search.TopDocs> rankResults)
      Description copied from class: QueryPhaseRankShardContext
      This is used to reduce the number of required results that are serialized to the coordinating node. Normally we would have to serialize queries * rank_window_size results, but we can infer that there will likely be overlap of document results. Given that we know any searches that match the same document must be on the same shard, we can sort on the shard instead for a top rank_window_size set of results and reduce the amount of data we serialize.
      Specified by:
      combineQueryPhaseResults in class QueryPhaseRankShardContext