Class BestBucketsDeferringCollector

  • All Implemented Interfaces:
    org.apache.lucene.search.Collector
    Direct Known Subclasses:
    MergingBucketsDeferringCollector

    public class BestBucketsDeferringCollector
    extends DeferringBucketCollector
    A specialization of DeferringBucketCollector that collects all matches and then is able to replay a given subset of buckets which represent the survivors from a pruning process performed by the aggregator that owns this collector.
    • Field Detail

      • entries

        protected java.util.List<org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector.Entry> entries
      • isGlobal

        protected final boolean isGlobal
      • context

        protected org.apache.lucene.index.LeafReaderContext context
      • docDeltasBuilder

        protected org.apache.lucene.util.packed.PackedLongValues.Builder docDeltasBuilder
      • bucketsBuilder

        protected org.apache.lucene.util.packed.PackedLongValues.Builder bucketsBuilder
      • maxBucket

        protected long maxBucket
      • finished

        protected boolean finished
      • selectedBuckets

        protected LongHash selectedBuckets
    • Constructor Detail

      • BestBucketsDeferringCollector

        public BestBucketsDeferringCollector​(SearchContext context,
                                             boolean isGlobal)
        Sole constructor.
        Parameters:
        context - The search context
        isGlobal - Whether this collector visits all documents (global context)
    • Method Detail

      • scoreMode

        public org.apache.lucene.search.ScoreMode scoreMode()
      • getLeafCollector

        public LeafBucketCollector getLeafCollector​(org.apache.lucene.index.LeafReaderContext ctx)
                                             throws java.io.IOException
        Specified by:
        getLeafCollector in interface org.apache.lucene.search.Collector
        Specified by:
        getLeafCollector in class BucketCollector
        Throws:
        java.io.IOException
      • preCollection

        public void preCollection()
                           throws java.io.IOException
        Description copied from class: BucketCollector
        Pre collection callback.
        Specified by:
        preCollection in class BucketCollector
        Throws:
        java.io.IOException
      • postCollection

        public void postCollection()
                            throws java.io.IOException
        Description copied from class: BucketCollector
        Post-collection callback.
        Specified by:
        postCollection in class BucketCollector
        Throws:
        java.io.IOException
      • prepareSelectedBuckets

        public void prepareSelectedBuckets​(long... selectedBuckets)
                                    throws java.io.IOException
        Replay the wrapped collector, but only on a selection of buckets.
        Specified by:
        prepareSelectedBuckets in class DeferringBucketCollector
        Throws:
        java.io.IOException