public abstract class AbstractSecondPassGroupingCollector<GROUP_VALUE_TYPE> extends SimpleCollector
See org.apache.lucene.search.grouping
for more
details including a full code example.
Modifier and Type | Class and Description |
---|---|
class |
AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE> |
Modifier and Type | Field and Description |
---|---|
protected AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE>[] |
groupDocs |
protected Map<GROUP_VALUE_TYPE,AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE>> |
groupMap |
Constructor and Description |
---|
AbstractSecondPassGroupingCollector(Collection<SearchGroup<GROUP_VALUE_TYPE>> groups,
Sort groupSort,
Sort withinGroupSort,
int maxDocsPerGroup,
boolean getScores,
boolean getMaxScores,
boolean fillSortFields) |
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 readerContext)
This method is called before collecting
context . |
TopGroups<GROUP_VALUE_TYPE> |
getTopGroups(int withinGroupOffset) |
protected abstract AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE> |
retrieveGroup(int doc)
Returns the group the specified doc belongs to or
null if no group could be retrieved. |
void |
setScorer(Scorer scorer)
Called before successive calls to
LeafCollector.collect(int) . |
getLeafCollector
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
needsScores
protected final Map<GROUP_VALUE_TYPE,AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE>> groupMap
protected AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE>[] groupDocs
public AbstractSecondPassGroupingCollector(Collection<SearchGroup<GROUP_VALUE_TYPE>> groups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException
IOException
public void setScorer(Scorer scorer) throws 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
IOException
public void collect(int doc) throws IOException
LeafCollector
Note: 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 LeafCollector
collect
in class SimpleCollector
IOException
protected abstract AbstractSecondPassGroupingCollector.SearchGroupDocs<GROUP_VALUE_TYPE> retrieveGroup(int doc) throws IOException
null
if no group could be retrieved.doc
- The specified docnull
if no group could be retrievedIOException
- If an I/O related error occurredprotected void doSetNextReader(LeafReaderContext readerContext) throws IOException
SimpleCollector
context
.doSetNextReader
in class SimpleCollector
IOException
public TopGroups<GROUP_VALUE_TYPE> getTopGroups(int withinGroupOffset)
Copyright © 2000–2015 The Apache Software Foundation. All rights reserved.