Class LeafBucketCollectorBase

All Implemented Interfaces:

public class LeafBucketCollectorBase extends LeafBucketCollector
A LeafBucketCollector that delegates all calls to the sub leaf aggregator and sets the scorer on its source of values if it implements ScorerAware.
  • Constructor Details

  • Method Details

    • setScorer

      public void setScorer( s) throws IOException
      Specified by:
      setScorer in interface
      setScorer in class LeafBucketCollector
    • collect

      public void collect(int doc, long bucket) throws IOException
      Description copied from class: LeafBucketCollector
      Collect the given doc in the bucket owned by owningBucketOrd.

      The implementation of this method metric aggregations is generally something along the lines of

       array[owningBucketOrd] += loadValueFromDoc(doc)

      Bucket aggregations have more trouble because their job is to make new ordinals. So their implementation generally looks kind of like

       long myBucketOrd = mapOwningBucketAndValueToMyOrd(owningBucketOrd, loadValueFromDoc(doc));
       collectBucket(doc, myBucketOrd);

      Some bucket aggregations "know" how many ordinals each owning ordinal needs so they can map "densely". The range aggregation, for example, can perform this mapping with something like:

       return rangeCount * owningBucketOrd + matchingRange(value);
      Other aggregations don't know how many buckets will fall into any particular owning bucket. The terms aggregation, for example, uses LongKeyedBucketOrds which amounts to a hash lookup.
      Specified by:
      collect in class LeafBucketCollector