public class TermFirstPassGroupingCollector extends AbstractFirstPassGroupingCollector<java.lang.String>
AbstractFirstPassGroupingCollector
that groups based on
field values and more specifically uses FieldCache.StringIndex
to collect groups.Constructor and Description |
---|
TermFirstPassGroupingCollector(java.lang.String groupField,
org.apache.lucene.search.Sort groupSort,
int topNGroups)
Create the first pass collector.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
copyDocGroupValue(java.lang.String groupValue,
java.lang.String 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 java.lang.String |
getDocGroupValue(int doc)
Returns the group value for the specified doc.
|
void |
setNextReader(org.apache.lucene.index.IndexReader reader,
int docBase) |
acceptsDocsOutOfOrder, collect, getTopGroups, setScorer
public TermFirstPassGroupingCollector(java.lang.String groupField, org.apache.lucene.search.Sort groupSort, int topNGroups) throws java.io.IOException
groupField
- The field used to group
documents. This field must be single-valued and
indexed (FieldCache 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 java.lang.String getDocGroupValue(int doc)
AbstractFirstPassGroupingCollector
getDocGroupValue
in class AbstractFirstPassGroupingCollector<java.lang.String>
doc
- The specified docprotected java.lang.String copyDocGroupValue(java.lang.String groupValue, java.lang.String reuse)
AbstractFirstPassGroupingCollector
copyDocGroupValue
in class AbstractFirstPassGroupingCollector<java.lang.String>
groupValue
- The group value to copyreuse
- Optionally a reuse instance to prevent a new instance creationpublic void setNextReader(org.apache.lucene.index.IndexReader reader, int docBase) throws java.io.IOException
setNextReader
in class AbstractFirstPassGroupingCollector<java.lang.String>
java.io.IOException
Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.