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.WrappedAggregator
NO_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, wrap
wrap
public 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.Collector
public void setDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)
setDeferredCollector
in class DeferringBucketCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws java.io.IOException
getLeafCollector
in interface org.apache.lucene.search.Collector
getLeafCollector
in class BucketCollector
java.io.IOException
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> createTopDocsCollector(int size) throws java.io.IOException
java.io.IOException
public void preCollection() throws java.io.IOException
BucketCollector
preCollection
in class BucketCollector
java.io.IOException
public void postCollection() throws java.io.IOException
BucketCollector
postCollection
in class BucketCollector
java.io.IOException
public void prepareSelectedBuckets(long... selectedBuckets) throws java.io.IOException
prepareSelectedBuckets
in class DeferringBucketCollector
java.io.IOException
public int getDocCount(long parentBucket)
public void close() throws ElasticsearchException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Releasable
ElasticsearchException