Class RankShardContext

java.lang.Object
org.elasticsearch.search.rank.RankShardContext

public abstract class RankShardContext extends Object
RankShardContext is a base class used to generate ranking results on each shard where it's responsible for executing any queries during the query phase required for its global ranking method.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
     
    protected final List<org.apache.lucene.search.Query>
     
    protected final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RankShardContext(List<org.apache.lucene.search.Query> queries, int from, int windowSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    combine(List<org.apache.lucene.search.TopDocs> rankResults)
    This is used to reduce the number of required results that are serialized to the coordinating node.
    List<org.apache.lucene.search.Query>
     
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • queries

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

      protected final int from
    • windowSize

      protected final int windowSize
  • Constructor Details

    • RankShardContext

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

    • queries

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

      public int windowSize()
    • combine

      public abstract RankShardResult combine(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 + knns)*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 window_size set of results and reduce the amount of data we serialize.