T
- the type of the value used for groupingC
- the type of Collector
used to reduce each grouppublic abstract class GroupReducer<T,C extends Collector>
extends java.lang.Object
newCollector()
, and
LeafCollector.collect(int)
is called for each document that is in
a groupSecondPassGroupingCollector
Modifier and Type | Class and Description |
---|---|
private static class |
GroupReducer.GroupCollector<C extends Collector> |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<T,GroupReducer.GroupCollector<C>> |
groups |
Constructor and Description |
---|
GroupReducer() |
Modifier and Type | Method and Description |
---|---|
void |
collect(T value,
int doc)
Collect a given document into a given group
|
C |
getCollector(T value)
Get the Collector for a given group
|
abstract boolean |
needsScores()
Whether or not this reducer requires collected documents to be scored
|
protected abstract C |
newCollector()
Creates a new Collector for each group
|
void |
setGroups(java.util.Collection<SearchGroup<T>> groups)
Define which groups should be reduced.
|
void |
setNextReader(LeafReaderContext ctx)
Called when the parent
SecondPassGroupingCollector moves to a new segment |
void |
setScorer(Scorable scorer)
Set the Scorer on all group collectors
|
private final java.util.Map<T,GroupReducer.GroupCollector<C extends Collector>> groups
public void setGroups(java.util.Collection<SearchGroup<T>> groups)
SecondPassGroupingCollector
public abstract boolean needsScores()
protected abstract C newCollector()
public final void collect(T value, int doc) throws java.io.IOException
java.io.IOException
- on errorpublic final void setScorer(Scorable scorer) throws java.io.IOException
java.io.IOException
public final void setNextReader(LeafReaderContext ctx) throws java.io.IOException
SecondPassGroupingCollector
moves to a new segmentjava.io.IOException