org.apache.lucene.search.grouping

Class AllGroupsCollector<T>

  • All Implemented Interfaces:
    Collector, LeafCollector
    Direct Known Subclasses:
    FunctionAllGroupsCollector, TermAllGroupsCollector


    public abstract class AllGroupsCollector<T>
    extends SimpleCollector
    A collector that collects all groups that match the query. Only the group value is collected, and the order is undefined. This collector does not determine the most relevant document of a group.

    This is an abstract version. Concrete implementations define what a group actually is and how it is internally collected.

    • Method Detail

      • getGroupCount

        public int getGroupCount()
        Returns the total number of groups for the executed search. This is a convenience method. The following code snippet has the same effect:
        getGroups().size()
        Returns:
        The total number of groups for the executed search
      • getGroups

        public abstract Collection<TgetGroups()
        Returns the group values

        This is an unordered collections of group values. For each group that matched the query there is a BytesRef representing a group value.

        Returns:
        the group values
      • needsScores

        public boolean needsScores()
        Description copied from interface: Collector
        Indicates if document scores are needed by this collector.
        Returns:
        true if scores are needed.