public abstract class AllGroupHeadsCollector<T> extends SimpleCollector
newCollector(GroupSelector, Sort)| Modifier and Type | Class and Description |
|---|---|
static class |
AllGroupHeadsCollector.GroupHead<T>
Represents a group head.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
compIDXEnd |
protected LeafReaderContext |
context |
protected java.util.Map<T,AllGroupHeadsCollector.GroupHead<T>> |
heads |
protected int[] |
reversed |
protected Scorer |
scorer |
protected Sort |
sort |
| Modifier and Type | Method and Description |
|---|---|
void |
collect(int doc)
Called once for every document matching a query, with the unbased document
number.
|
protected void |
doSetNextReader(LeafReaderContext context)
This method is called before collecting
context. |
protected java.util.Collection<? extends AllGroupHeadsCollector.GroupHead<T>> |
getCollectedGroupHeads()
Returns the collected group heads.
|
int |
groupHeadsSize() |
boolean |
needsScores()
Indicates if document scores are needed by this collector.
|
static <T> AllGroupHeadsCollector<T> |
newCollector(GroupSelector<T> selector,
Sort sort)
Create a new AllGroupHeadsCollector based on the type of within-group Sort required
|
protected abstract AllGroupHeadsCollector.GroupHead<T> |
newGroupHead(int doc,
T value,
LeafReaderContext context,
Scorer scorer)
Create a new GroupHead for the given group value, initialized with a doc, context and scorer
|
int[] |
retrieveGroupHeads() |
FixedBitSet |
retrieveGroupHeads(int maxDoc) |
void |
setScorer(Scorer scorer)
Called before successive calls to
LeafCollector.collect(int). |
getLeafCollectorprotected final Sort sort
protected final int[] reversed
protected final int compIDXEnd
protected java.util.Map<T,AllGroupHeadsCollector.GroupHead<T>> heads
protected LeafReaderContext context
protected Scorer scorer
public static <T> AllGroupHeadsCollector<T> newCollector(GroupSelector<T> selector, Sort sort)
T - the group value typeselector - a GroupSelector to define the groupssort - the within-group sort to use to choose the group head documentpublic FixedBitSet retrieveGroupHeads(int maxDoc)
maxDoc - The maxDoc of the top level IndexReader.FixedBitSet containing all group heads.public int[] retrieveGroupHeads()
public int groupHeadsSize()
protected java.util.Collection<? extends AllGroupHeadsCollector.GroupHead<T>> getCollectedGroupHeads()
public void collect(int doc)
throws java.io.IOException
LeafCollectorNote: The collection of the current segment can be terminated by throwing
a CollectionTerminatedException. In this case, the last docs of the
current LeafReaderContext will be skipped and IndexSearcher
will swallow the exception and continue collection with the next leaf.
Note: This is called in an inner search loop. For good search performance,
implementations of this method should not call IndexSearcher.doc(int) or
IndexReader.document(int) on every hit.
Doing so can slow searches by an order of magnitude or more.
collect in interface LeafCollectorcollect in class SimpleCollectorjava.io.IOExceptionpublic boolean needsScores()
Collectortrue if scores are needed.protected void doSetNextReader(LeafReaderContext context) throws java.io.IOException
SimpleCollectorcontext.doSetNextReader in class SimpleCollectorjava.io.IOExceptionpublic void setScorer(Scorer scorer) throws java.io.IOException
LeafCollectorLeafCollector.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 LeafCollectorsetScorer in class SimpleCollectorjava.io.IOExceptionprotected abstract AllGroupHeadsCollector.GroupHead<T> newGroupHead(int doc, T value, LeafReaderContext context, Scorer scorer) throws java.io.IOException
java.io.IOExceptionCopyright © 2000–2025 The Apache Software Foundation. All rights reserved.