Class BestBucketsDeferringCollector
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
org.elasticsearch.search.aggregations.bucket.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.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
DeferringBucketCollector.WrappedAggregator
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.lucene.util.packed.PackedLongValues.Builder
bucketsBuilder
protected BucketCollector
collector
protected org.apache.lucene.index.LeafReaderContext
context
protected org.apache.lucene.util.packed.PackedLongValues.Builder
docDeltasBuilder
protected java.util.List<org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector.Entry>
entries
protected boolean
finished
protected boolean
isGlobal
protected long
maxBucket
protected SearchContext
searchContext
protected LongHash
selectedBuckets
-
Constructor Summary
Constructors Constructor Description BestBucketsDeferringCollector(SearchContext context, boolean isGlobal)
Sole constructor. -
Method Summary
Modifier and Type Method Description LeafBucketCollector
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx)
void
postCollection()
Post-collection callback.void
preCollection()
Pre collection callback.void
prepareSelectedBuckets(long... selectedBuckets)
Replay the wrapped collector, but only on a selection of buckets.org.apache.lucene.search.ScoreMode
scoreMode()
void
setDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)
Set the deferred collectors.Aggregator
wrap(Aggregator in)
Wrap the provided aggregator so that it behaves (almost) as if it had been collected directly.Methods inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
replay
-
Field Details
-
entries
protected java.util.List<org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector.Entry> entries -
collector
-
searchContext
-
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
-
-
Constructor Details
-
BestBucketsDeferringCollector
Sole constructor.- Parameters:
context
- The search contextisGlobal
- Whether this collector visits all documents (global context)
-
-
Method Details
-
scoreMode
public org.apache.lucene.search.ScoreMode scoreMode() -
setDeferredCollector
Set the deferred collectors.- Specified by:
setDeferredCollector
in classDeferringBucketCollector
-
getLeafCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws java.io.IOException- Specified by:
getLeafCollector
in interfaceorg.apache.lucene.search.Collector
- Specified by:
getLeafCollector
in classBucketCollector
- Throws:
java.io.IOException
-
preCollection
public void preCollection() throws java.io.IOExceptionDescription copied from class:BucketCollector
Pre collection callback.- Specified by:
preCollection
in classBucketCollector
- Throws:
java.io.IOException
-
postCollection
public void postCollection() throws java.io.IOExceptionDescription copied from class:BucketCollector
Post-collection callback.- Specified by:
postCollection
in classBucketCollector
- Throws:
java.io.IOException
-
prepareSelectedBuckets
public void prepareSelectedBuckets(long... selectedBuckets) throws java.io.IOExceptionReplay the wrapped collector, but only on a selection of buckets.- Specified by:
prepareSelectedBuckets
in classDeferringBucketCollector
- Throws:
java.io.IOException
-
wrap
Wrap the provided aggregator so that it behaves (almost) as if it had been collected directly.- Overrides:
wrap
in classDeferringBucketCollector
-