org.apache.lucene.search.grouping
Class FirstPassGroupingCollector
java.lang.Object
org.apache.lucene.search.Collector
org.apache.lucene.search.grouping.FirstPassGroupingCollector
public class FirstPassGroupingCollector
- extends org.apache.lucene.search.Collector
FirstPassGroupingCollector is the first of two passes necessary
to collect grouped hits. This pass gathers the top N sorted
groups.
See org.apache.lucene.search.grouping
for more
details including a full code example.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FirstPassGroupingCollector
public FirstPassGroupingCollector(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
- 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.
- Throws:
IOException
getTopGroups
public Collection<SearchGroup> getTopGroups(int groupOffset,
boolean fillFields)
- Returns top groups, starting from offset. This may
return null, if no groups were collected, or if the
number of unique groups collected is <= offset.
getGroupField
public String getGroupField()
setScorer
public void setScorer(org.apache.lucene.search.Scorer scorer)
throws IOException
- Specified by:
setScorer
in class org.apache.lucene.search.Collector
- Throws:
IOException
collect
public void collect(int doc)
throws IOException
- Specified by:
collect
in class org.apache.lucene.search.Collector
- Throws:
IOException
acceptsDocsOutOfOrder
public boolean acceptsDocsOutOfOrder()
- Specified by:
acceptsDocsOutOfOrder
in class org.apache.lucene.search.Collector
setNextReader
public void setNextReader(org.apache.lucene.index.IndexReader reader,
int docBase)
throws IOException
- Specified by:
setNextReader
in class org.apache.lucene.search.Collector
- Throws:
IOException
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.