public class TermFirstPassGroupingCollector extends AbstractFirstPassGroupingCollector<BytesRef>
AbstractFirstPassGroupingCollector that groups based on
field values and more specifically uses SortedDocValues
to collect groups.| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
groupField |
private SortedDocValues |
index |
orderedGroups| Constructor and Description |
|---|
TermFirstPassGroupingCollector(java.lang.String groupField,
Sort groupSort,
int topNGroups)
Create the first pass collector.
|
| Modifier and Type | Method and Description |
|---|---|
protected BytesRef |
copyDocGroupValue(BytesRef groupValue,
BytesRef reuse)
Returns a copy of the specified group value by creating a new instance and copying the value from the specified
groupValue in the new instance.
|
protected void |
doSetNextReader(LeafReaderContext readerContext)
This method is called before collecting
context. |
protected BytesRef |
getDocGroupValue(int doc)
Returns the group value for the specified doc.
|
collect, getTopGroups, needsScores, setScorergetLeafCollectorprivate SortedDocValues index
private java.lang.String groupField
public TermFirstPassGroupingCollector(java.lang.String groupField,
Sort groupSort,
int topNGroups)
throws java.io.IOException
groupField - The field used to group
documents. This field must be single-valued and
indexed (DocValues is used to access its value
per-document).groupSort - The Sort used to sort the
groups. The top sorted document within each group
according to groupSort, determines how that group
sorts against other groups. This must be non-null,
ie, if you want to groupSort by relevance use
Sort.RELEVANCE.topNGroups - How many top groups to keep.java.io.IOException - When I/O related errors occurprotected BytesRef getDocGroupValue(int doc)
AbstractFirstPassGroupingCollectorgetDocGroupValue in class AbstractFirstPassGroupingCollector<BytesRef>doc - The specified docprotected BytesRef copyDocGroupValue(BytesRef groupValue, BytesRef reuse)
AbstractFirstPassGroupingCollectorcopyDocGroupValue in class AbstractFirstPassGroupingCollector<BytesRef>groupValue - The group value to copyreuse - Optionally a reuse instance to prevent a new instance creationprotected void doSetNextReader(LeafReaderContext readerContext) throws java.io.IOException
SimpleCollectorcontext.doSetNextReader in class AbstractFirstPassGroupingCollector<BytesRef>java.io.IOException