Class TermFirstPassGroupingCollector
- java.lang.Object
-
- org.apache.lucene.search.Collector
-
- org.apache.lucene.search.grouping.AbstractFirstPassGroupingCollector<String>
-
- org.apache.lucene.search.grouping.TermFirstPassGroupingCollector
-
public class TermFirstPassGroupingCollector extends AbstractFirstPassGroupingCollector<String>
Concrete implementation ofAbstractFirstPassGroupingCollectorthat groups based on field values and more specifically usesFieldCache.StringIndexto collect groups.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Constructor Description TermFirstPassGroupingCollector(String groupField, org.apache.lucene.search.Sort groupSort, int topNGroups)Create the first pass collector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringcopyDocGroupValue(String groupValue, 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 StringgetDocGroupValue(int doc)Returns the group value for the specified doc.voidsetNextReader(org.apache.lucene.index.IndexReader reader, int docBase)-
Methods inherited from class org.apache.lucene.search.grouping.AbstractFirstPassGroupingCollector
acceptsDocsOutOfOrder, collect, getTopGroups, setScorer
-
-
-
-
Constructor Detail
-
TermFirstPassGroupingCollector
public TermFirstPassGroupingCollector(String groupField, org.apache.lucene.search.Sort groupSort, int topNGroups) throws IOException
Create the first pass collector.- Parameters:
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- TheSortused 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.- Throws:
IOException- When I/O related errors occur
-
-
Method Detail
-
getDocGroupValue
protected String getDocGroupValue(int doc)
Description copied from class:AbstractFirstPassGroupingCollectorReturns the group value for the specified doc.- Specified by:
getDocGroupValuein classAbstractFirstPassGroupingCollector<String>- Parameters:
doc- The specified doc- Returns:
- the group value for the specified doc
-
copyDocGroupValue
protected String copyDocGroupValue(String groupValue, String reuse)
Description copied from class:AbstractFirstPassGroupingCollectorReturns a copy of the specified group value by creating a new instance and copying the value from the specified groupValue in the new instance. Or optionally the reuse argument can be used to copy the group value in.- Specified by:
copyDocGroupValuein classAbstractFirstPassGroupingCollector<String>- Parameters:
groupValue- The group value to copyreuse- Optionally a reuse instance to prevent a new instance creation- Returns:
- a copy of the specified group value
-
setNextReader
public void setNextReader(org.apache.lucene.index.IndexReader reader, int docBase) throws IOException- Overrides:
setNextReaderin classAbstractFirstPassGroupingCollector<String>- Throws:
IOException
-
-