Class LeafBucketCollector
java.lang.Object
org.elasticsearch.search.aggregations.LeafBucketCollector
- All Implemented Interfaces:
- org.apache.lucene.search.LeafCollector
- Direct Known Subclasses:
- LeafBucketCollectorBase,- ProfilingLeafBucketCollector
public abstract class LeafBucketCollector
extends Object
implements org.apache.lucene.search.LeafCollector
Collects results for a particular segment. See the docs for
 
collect(int, long) for how
 to do the collecting.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic LeafBucketCollectorA LeafBucketCollector that doesn't collect anything.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcollect(int doc)abstract voidcollect(int doc, long owningBucketOrd)Collect the givendocin the bucket owned byowningBucketOrd.booleanisNoop()Does this collector collect anything? If this returns true we can safely just never callcollect(int, long).voidsetScorer(org.apache.lucene.search.Scorable scorer)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.search.LeafCollectorcompetitiveIterator
- 
Field Details- 
NO_OP_COLLECTORA LeafBucketCollector that doesn't collect anything.Aggregators will return this if they've already collected their results and don't need to hook into the primary search. It is always safe to skip calling this callingsetScorer(org.apache.lucene.search.Scorable)andcollect(int, long)on this collector.
 
- 
- 
Constructor Details- 
LeafBucketCollectorpublic LeafBucketCollector()
 
- 
- 
Method Details- 
collectCollect the givendocin the bucket owned byowningBucketOrd.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 rangeaggregation, for example, can perform this mapping with something like:
 Other aggregations don't know how many buckets will fall into any particular owning bucket. Thereturn rangeCount * owningBucketOrd + matchingRange(value);termsaggregation, for example, usesLongKeyedBucketOrdswhich amounts to a hash lookup.- Throws:
- IOException
 
- 
isNooppublic boolean isNoop()Does this collector collect anything? If this returns true we can safely just never callcollect(int, long).
- 
collect- Specified by:
- collectin interface- org.apache.lucene.search.LeafCollector
- Throws:
- IOException
 
- 
setScorer- Specified by:
- setScorerin interface- org.apache.lucene.search.LeafCollector
- Throws:
- IOException
 
 
-