org.apache.lucene.facet.search.aggregator
Class CountingAggregator

java.lang.Object
  extended by org.apache.lucene.facet.search.aggregator.CountingAggregator
All Implemented Interfaces:
Aggregator
Direct Known Subclasses:
ComplementCountingAggregator

public class CountingAggregator
extends Object
implements Aggregator

A CountingAggregator updates a counter array with the size of the whole taxonomy, counting the number of times each category appears in the given set of documents.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
protected  int[] counterArray
           
 
Constructor Summary
CountingAggregator(int[] counterArray)
           
 
Method Summary
 void aggregate(int ordinal)
          Collect (and do whatever an implementation deems appropriate) the category given by its ordinal.
 boolean equals(Object obj)
           
 int hashCode()
           
 void setNextDoc(int docid, float score)
          Specify the document (and its score in the search) that the following Aggregator.aggregate(int) calls will pertain to.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

counterArray

protected int[] counterArray
Constructor Detail

CountingAggregator

public CountingAggregator(int[] counterArray)
Method Detail

aggregate

public void aggregate(int ordinal)
Description copied from interface: Aggregator
Collect (and do whatever an implementation deems appropriate) the category given by its ordinal. This category belongs to a document given earlier by Aggregator.setNextDoc(int, float).

Specified by:
aggregate in interface Aggregator

setNextDoc

public void setNextDoc(int docid,
                       float score)
Description copied from interface: Aggregator
Specify the document (and its score in the search) that the following Aggregator.aggregate(int) calls will pertain to.

Specified by:
setNextDoc in interface Aggregator

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object