org.apache.lucene.search.grouping

## Class AllGroupsCollector<T>

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.lucene.search.grouping.AllGroupsCollector<T>

- All Implemented Interfaces:
    Collector, LeafCollector

      public 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.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AllGroupsCollector(GroupSelector<T> groupSelector)` Create a new AllGroupsCollector

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `collect(int doc)`
    `protected void` | `doSetNextReader(LeafReaderContext context)`
    `int` | `getGroupCount()` Returns the total number of groups for the executed search.
    `Collection<T>` | `getGroups()` Returns the group values
    `ScoreMode` | `scoreMode()`
    `void` | `setScorer(Scorable scorer)`

    - ### Methods inherited from class org.apache.lucene.search.SimpleCollector

      `getLeafCollector`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.lucene.search.LeafCollector

      `competitiveIterator`

- - ### Constructor Detail

    - #### AllGroupsCollector

          public AllGroupsCollector(GroupSelector<T> groupSelector)

      Create a new AllGroupsCollector
      Parameters:
        `groupSelector` - the GroupSelector to determine groups

  - ### 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 Collection<T> getGroups()

      Returns the group values

      This is an unordered collections of group values.

      Returns:
        the group values

    - #### setScorer

          public void setScorer(Scorable scorer)
                         throws IOException

      Specified by:
        `setScorer` in interface `LeafCollector`
      Overrides:
        `setScorer` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### doSetNextReader

          protected void doSetNextReader(LeafReaderContext context)
                                  throws IOException

      Overrides:
        `doSetNextReader` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### collect

          public void collect(int doc)
                       throws IOException

      Specified by:
        `collect` in interface `LeafCollector`
      Specified by:
        `collect` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### scoreMode

          public ScoreMode scoreMode()

Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.