Class QueryPhaseRankShardContext

java.lang.Object
org.elasticsearch.search.rank.context.QueryPhaseRankShardContext
Direct Known Subclasses:
RerankingQueryPhaseRankShardContext

public abstract class QueryPhaseRankShardContext extends Object
QueryPhaseRankShardContext is used to generate the top rank_window_size results on each shard. It specifies the queries to run during QueryPhase and is responsible for combining all query scores and order all results through the combineQueryPhaseResults(java.util.List<org.apache.lucene.search.TopDocs>) method.
  • Field Details

    • queries

      protected final List<org.apache.lucene.search.Query> queries
    • rankWindowSize

      protected final int rankWindowSize
  • Constructor Details

    • QueryPhaseRankShardContext

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

    • queries

      public List<org.apache.lucene.search.Query> queries()
    • rankWindowSize

      public int rankWindowSize()
    • combineQueryPhaseResults

      public abstract RankShardResult combineQueryPhaseResults(List<org.apache.lucene.search.TopDocs> rankResults)
      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.