Class QueryPhaseCollector

java.lang.Object
org.elasticsearch.search.query.QueryPhaseCollector
All Implemented Interfaces:
org.apache.lucene.search.Collector, TwoPhaseCollector

public final class QueryPhaseCollector extends Object implements TwoPhaseCollector
Top-level collector used in the query phase to perform top hits collection as well as aggs collection. Inspired by MultiCollector but specialized for wrapping two collectors and filtering collected documents as follows: - through an optional post_filter that is applied to the top hits collection - through an optional min_score threshold, which is applied to both the top hits as well as aggs. Supports also terminating the collection after a certain number of documents have been collected (terminate_after). When top docs as well as aggs are collected (because both collectors were provided), skipping low scoring hits via Scorable.setMinCompetitiveScore(float) is not supported for either of the collectors.
  • Method Details

    • setWeight

      public void setWeight(org.apache.lucene.search.Weight weight)
      Specified by:
      setWeight in interface org.apache.lucene.search.Collector
    • scoreMode

      public org.apache.lucene.search.ScoreMode scoreMode()
      Specified by:
      scoreMode in interface org.apache.lucene.search.Collector
    • getLeafCollector

      public org.apache.lucene.search.LeafCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext context) throws IOException
      Specified by:
      getLeafCollector in interface org.apache.lucene.search.Collector
      Throws:
      IOException
    • doPostCollection

      public void doPostCollection() throws IOException
      Description copied from interface: TwoPhaseCollector
      run post-collection phase
      Specified by:
      doPostCollection in interface TwoPhaseCollector
      Throws:
      IOException