Class FirstPassGroupingCollector<T>
java.lang.Object
org.apache.lucene.search.SimpleCollector
org.apache.lucene.search.grouping.FirstPassGroupingCollector<T>
- All Implemented Interfaces:
Collector,LeafCollector
FirstPassGroupingCollector is the first of two passes necessary to collect grouped hits. This
pass gathers the top N sorted groups. Groups are defined by a
GroupSelector
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFirstPassGroupingCollector(GroupSelector<T> groupSelector, Sort groupSort, int topNGroups) Create the first pass collector. -
Method Summary
Modifier and TypeMethodDescriptionvoidcollect(int doc) protected voiddoSetNextReader(LeafReaderContext readerContext) getTopGroups(int groupOffset) Returns top groups, starting from offset.voidMethods inherited from class org.apache.lucene.search.SimpleCollector
getLeafCollectorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.search.LeafCollector
collect, competitiveIterator, finish
-
Field Details
-
orderedGroups
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Constructor Details
-
FirstPassGroupingCollector
Create the first pass collector.- Parameters:
groupSelector- a GroupSelector used to defined groupsgroupSort- 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.
-
-
Method Details
-
scoreMode
-
getTopGroups
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.- Parameters:
groupOffset- The offset in the collected groups- Returns:
- top groups, starting from offset
- Throws:
IOException
-
setScorer
- Specified by:
setScorerin interfaceLeafCollector- Overrides:
setScorerin classSimpleCollector- Throws:
IOException
-
collect
- Specified by:
collectin interfaceLeafCollector- Specified by:
collectin classSimpleCollector- Throws:
IOException
-
doSetNextReader
- Overrides:
doSetNextReaderin classSimpleCollector- Throws:
IOException
-
getGroupSelector
- Returns:
- the GroupSelector used for this Collector
-