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(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(Iterable<BucketCollector> deferredCollectors)
setDeferredCollector
in class DeferringBucketCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws IOException
getLeafCollector
in interface org.apache.lucene.search.Collector
getLeafCollector
in class BucketCollector
IOException
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> createTopDocsCollector(int size) throws IOException
IOException
public void preCollection() throws IOException
BucketCollector
preCollection
in class BucketCollector
IOException
public void postCollection() throws IOException
BucketCollector
postCollection
in class BucketCollector
IOException
public void prepareSelectedBuckets(long... selectedBuckets) throws IOException
prepareSelectedBuckets
in class DeferringBucketCollector
IOException
public int getDocCount(long parentBucket)
public void close() throws ElasticsearchException
close
in interface AutoCloseable
close
in interface Releasable
ElasticsearchException
Copyright © 2009–2016. All rights reserved.