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 Map<T,AllGroupHeadsCollector.GroupHead<T>> |
heads |
protected int[] |
reversed |
protected Scorable |
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 Collection<? extends AllGroupHeadsCollector.GroupHead<T>> |
getCollectedGroupHeads()
Returns the collected group heads.
|
int |
groupHeadsSize() |
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,
Scorable scorer)
Create a new GroupHead for the given group value, initialized with a doc, context and scorer
|
int[] |
retrieveGroupHeads() |
FixedBitSet |
retrieveGroupHeads(int maxDoc) |
ScoreMode |
scoreMode()
Indicates what features are required from the scorer.
|
void |
setScorer(Scorable scorer)
Called before successive calls to
LeafCollector.collect(int). |
getLeafCollectorprotected final Sort sort
protected final int[] reversed
protected final int compIDXEnd
protected Map<T,AllGroupHeadsCollector.GroupHead<T>> heads
protected LeafReaderContext context
protected Scorable 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 Collection<? extends AllGroupHeadsCollector.GroupHead<T>> getCollectedGroupHeads()
public void collect(int doc)
throws 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 SimpleCollectorIOExceptionpublic ScoreMode scoreMode()
Collectorprotected void doSetNextReader(LeafReaderContext context) throws IOException
SimpleCollectorcontext.doSetNextReader in class SimpleCollectorIOExceptionpublic void setScorer(Scorable scorer) throws 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 SimpleCollectorIOExceptionprotected abstract AllGroupHeadsCollector.GroupHead<T> newGroupHead(int doc, T value, LeafReaderContext context, Scorable scorer) throws IOException
IOExceptionCopyright © 2000–2020 The Apache Software Foundation. All rights reserved.