public class BestDocsDeferringCollector extends DeferringBucketCollector implements Releasable
DeferringBucketCollector that collects all
matches and then replays only the top scoring documents to child
aggregations. The method
createTopDocsCollector(int) is designed to
be overridden and allows subclasses to choose a custom collector
implementation for determining the top N matches.DeferringBucketCollector.WrappedAggregatorNO_OP_COLLECTOR| Constructor and Description |
|---|
BestDocsDeferringCollector(int shardSize,
BigArrays bigArrays)
Sole constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> |
createTopDocsCollector(int size) |
int |
getDocCount(long parentBucket) |
LeafBucketCollector |
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) |
boolean |
needsScores() |
void |
postCollection()
Post-collection callback.
|
void |
preCollection()
Pre collection callback.
|
void |
prepareSelectedBuckets(long... selectedBuckets) |
void |
setDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)
Set the deferred collectors.
|
replay, wrapwrappublic BestDocsDeferringCollector(int shardSize,
BigArrays bigArrays)
shardSize - The number of top-scoring docs to collect for each bucketpublic boolean needsScores()
needsScores in interface org.apache.lucene.search.Collectorpublic void setDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)
setDeferredCollector in class DeferringBucketCollectorpublic LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws java.io.IOException
getLeafCollector in interface org.apache.lucene.search.CollectorgetLeafCollector in class BucketCollectorjava.io.IOExceptionprotected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> createTopDocsCollector(int size)
throws java.io.IOException
java.io.IOExceptionpublic void preCollection()
throws java.io.IOException
BucketCollectorpreCollection in class BucketCollectorjava.io.IOExceptionpublic void postCollection()
throws java.io.IOException
BucketCollectorpostCollection in class BucketCollectorjava.io.IOExceptionpublic void prepareSelectedBuckets(long... selectedBuckets)
throws java.io.IOException
prepareSelectedBuckets in class DeferringBucketCollectorjava.io.IOExceptionpublic int getDocCount(long parentBucket)
public void close()
throws ElasticsearchException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface ReleasableElasticsearchException