public class FunctionAllGroupHeadsCollector extends AbstractAllGroupHeadsCollector<FunctionAllGroupHeadsCollector.GroupHead>
AbstractAllGroupHeadsCollector
for retrieving the most relevant groups when grouping
by ValueSource
.Modifier and Type | Class and Description |
---|---|
class |
FunctionAllGroupHeadsCollector.GroupHead
Holds current head document for a single group.
|
AbstractAllGroupHeadsCollector.TemporalResult
Modifier and Type | Field and Description |
---|---|
private FunctionValues.ValueFiller |
filler |
private ValueSource |
groupBy |
private java.util.Map<MutableValue,FunctionAllGroupHeadsCollector.GroupHead> |
groups |
private MutableValue |
mval |
private LeafReaderContext |
readerContext |
private Scorer |
scorer |
private Sort |
sortWithinGroup |
private java.util.Map<?,?> |
vsContext |
compIDXEnd, reversed, temporalResult
Constructor and Description |
---|
FunctionAllGroupHeadsCollector(ValueSource groupBy,
java.util.Map<?,?> vsContext,
Sort sortWithinGroup)
Constructs a
FunctionAllGroupHeadsCollector instance. |
Modifier and Type | Method and Description |
---|---|
protected void |
doSetNextReader(LeafReaderContext context)
This method is called before collecting
context . |
protected java.util.Collection<FunctionAllGroupHeadsCollector.GroupHead> |
getCollectedGroupHeads()
Returns the collected group heads.
|
boolean |
needsScores()
Indicates if document scores are needed by this collector.
|
protected void |
retrieveGroupHeadAndAddIfNotExist(int doc)
Returns the group head and puts it into
AbstractAllGroupHeadsCollector.temporalResult . |
void |
setScorer(Scorer scorer)
Called before successive calls to
LeafCollector.collect(int) . |
collect, groupHeadsSize, retrieveGroupHeads, retrieveGroupHeads
getLeafCollector
private final ValueSource groupBy
private final java.util.Map<?,?> vsContext
private final java.util.Map<MutableValue,FunctionAllGroupHeadsCollector.GroupHead> groups
private final Sort sortWithinGroup
private FunctionValues.ValueFiller filler
private MutableValue mval
private LeafReaderContext readerContext
private Scorer scorer
public FunctionAllGroupHeadsCollector(ValueSource groupBy, java.util.Map<?,?> vsContext, Sort sortWithinGroup)
FunctionAllGroupHeadsCollector
instance.groupBy
- The ValueSource
to group byvsContext
- The ValueSource contextsortWithinGroup
- The sort within a groupprotected void retrieveGroupHeadAndAddIfNotExist(int doc) throws java.io.IOException
AbstractAllGroupHeadsCollector
AbstractAllGroupHeadsCollector.temporalResult
.
If the group head wasn't encountered before then it will be added to the collected group heads.
The AbstractAllGroupHeadsCollector.TemporalResult.stop
property will be true
if the group head wasn't encountered before
otherwise false
.
retrieveGroupHeadAndAddIfNotExist
in class AbstractAllGroupHeadsCollector<FunctionAllGroupHeadsCollector.GroupHead>
doc
- The document to retrieve the group head for.java.io.IOException
- If I/O related errors occurprotected java.util.Collection<FunctionAllGroupHeadsCollector.GroupHead> getCollectedGroupHeads()
AbstractAllGroupHeadsCollector
getCollectedGroupHeads
in class AbstractAllGroupHeadsCollector<FunctionAllGroupHeadsCollector.GroupHead>
public void setScorer(Scorer scorer) throws java.io.IOException
LeafCollector
LeafCollector.collect(int)
. Implementations
that need the score of the current document (passed-in to
LeafCollector.collect(int)
), should save the passed-in Scorer and call
scorer.score() when needed.setScorer
in interface LeafCollector
setScorer
in class SimpleCollector
java.io.IOException
protected void doSetNextReader(LeafReaderContext context) throws java.io.IOException
SimpleCollector
context
.doSetNextReader
in class SimpleCollector
java.io.IOException
public boolean needsScores()
Collector
true
if scores are needed.