public abstract class AggregatorBase extends Aggregator
Aggregator.Parser, Aggregator.SubAggCollectionMode
Modifier and Type | Field and Description |
---|---|
protected BucketCollector |
collectableSubAggregators |
protected AggregationContext |
context |
protected String |
name |
protected Aggregator |
parent |
protected Aggregator[] |
subAggregators |
NO_OP_COLLECTOR
Modifier | Constructor and Description |
---|---|
protected |
AggregatorBase(String name,
AggregatorFactories factories,
AggregationContext context,
Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String,Object> metaData)
Constructs a new Aggregator.
|
Modifier and Type | Method and Description |
---|---|
protected InternalAggregations |
buildEmptySubAggregations() |
void |
close()
Called upon release of the aggregator.
|
AggregationContext |
context()
Return the
AggregationContext attached with this Aggregator . |
protected void |
doClose()
Release instance-specific data.
|
protected void |
doPostCollection()
Can be overriden by aggregator implementation to be called back when the collection phase ends.
|
protected void |
doPreCollection()
Can be overriden by aggregator implementation to be called back when the collection phase starts.
|
DeferringBucketCollector |
getDeferringCollector() |
LeafBucketCollector |
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) |
protected abstract LeafBucketCollector |
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx,
LeafBucketCollector sub)
Get a
LeafBucketCollector for the given ctx, which should
delegate to the given collector. |
Map<String,Object> |
metaData() |
String |
name()
Return the name of this aggregator.
|
boolean |
needsScores()
Most aggregators don't need scores, make sure to extend this method if
your aggregator needs them.
|
Aggregator |
parent()
Return the parent aggregator.
|
List<PipelineAggregator> |
pipelineAggregators() |
void |
postCollection()
Called after collection of all document is done.
|
void |
preCollection()
Pre collection callback.
|
protected void |
runDeferredCollections(long... bucketOrds) |
protected boolean |
shouldDefer(Aggregator aggregator)
This method should be overidden by subclasses that want to defer calculation
of a child aggregation until a first pass is complete and a set of buckets has
been pruned.
|
Aggregator |
subAggregator(String aggName)
Return the sub aggregator with the provided name.
|
Aggregator[] |
subAggregators() |
String |
toString() |
buildAggregation, buildEmptyAggregation, descendsFromBucketAggregator
wrap
protected final String name
protected final Aggregator parent
protected final AggregationContext context
protected final Aggregator[] subAggregators
protected BucketCollector collectableSubAggregators
protected AggregatorBase(String name, AggregatorFactories factories, AggregationContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String,Object> metaData) throws IOException
name
- The name of the aggregationfactories
- The factories for all the sub-aggregators under this aggregatorcontext
- The aggregation contextparent
- The parent aggregator (may be null
for top level aggregators)metaData
- The metaData associated with this aggregatorIOException
public boolean needsScores()
public List<PipelineAggregator> pipelineAggregators()
protected abstract LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx, LeafBucketCollector sub) throws IOException
LeafBucketCollector
for the given ctx, which should
delegate to the given collector.IOException
public final LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws IOException
getLeafCollector
in interface org.apache.lucene.search.Collector
getLeafCollector
in class BucketCollector
IOException
protected void doPreCollection() throws IOException
IOException
public final void preCollection() throws IOException
BucketCollector
preCollection
in class BucketCollector
IOException
public DeferringBucketCollector getDeferringCollector()
protected boolean shouldDefer(Aggregator aggregator)
runDeferredCollections(long...)
for the selected set of buckets that survive the pruning.aggregator
- the child aggregatorprotected final void runDeferredCollections(long... bucketOrds) throws IOException
IOException
public String name()
Aggregator
name
in class Aggregator
public Aggregator parent()
Aggregator
parent
in class Aggregator
null
if there is none (meaning, this aggregator is a top level one)public Aggregator[] subAggregators()
public Aggregator subAggregator(String aggName)
Aggregator
subAggregator
in class Aggregator
public AggregationContext context()
Aggregator
AggregationContext
attached with this Aggregator
.context
in class Aggregator
public final void postCollection() throws IOException
postCollection
in class BucketCollector
IOException
public void close()
protected void doClose()
protected void doPostCollection() throws IOException
IOException
protected final InternalAggregations buildEmptySubAggregations()
Copyright © 2009–2016. All rights reserved.