Class FirstPassGroupingCollector<T>

  • All Implemented Interfaces:
    Collector, LeafCollector

    public class FirstPassGroupingCollector<T>
    extends SimpleCollector
    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 Detail

      • orderedGroups

        protected TreeSet<CollectedSearchGroup<T>> orderedGroups
        NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Constructor Detail

      • FirstPassGroupingCollector

        public FirstPassGroupingCollector​(GroupSelector<T> groupSelector,
                                          Sort groupSort,
                                          int topNGroups)
        Create the first pass collector.
        Parameters:
        groupSelector - a GroupSelector used to defined groups
        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.