Class GroupReducer<T,C extends Collector>
java.lang.Object
org.apache.lucene.search.grouping.GroupReducer<T,C>
- Type Parameters:
T
- the type of the value used for groupingC
- the type ofCollector
used to reduce each group
Concrete implementations of this class define what to collect for individual groups during the
second-pass of a grouping search.
Each group is assigned a Collector returned by newCollector()
, and LeafCollector.collect(int)
is called for each document that is in a group
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Collect a given document into a given groupfinal C
getCollector
(T value) Get the Collector for a given groupabstract boolean
Whether or not this reducer requires collected documents to be scoredprotected abstract C
Creates a new Collector for each groupvoid
setGroups
(Collection<SearchGroup<T>> groups) Define which groups should be reduced.final void
Called when the parentSecondPassGroupingCollector
moves to a new segmentfinal void
Set the Scorer on all group collectors
-
Constructor Details
-
GroupReducer
public GroupReducer()
-
-
Method Details
-
setGroups
Define which groups should be reduced.Called by
SecondPassGroupingCollector
-
needsScores
public abstract boolean needsScores()Whether or not this reducer requires collected documents to be scored -
newCollector
Creates a new Collector for each group -
getCollector
Get the Collector for a given group -
collect
Collect a given document into a given group- Throws:
IOException
- on error
-
setScorer
Set the Scorer on all group collectors- Throws:
IOException
-
setNextReader
Called when the parentSecondPassGroupingCollector
moves to a new segment- Throws:
IOException
-