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
  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.

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AllGroupsCollector()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getGroupCount()` Returns the total number of groups for the executed search.
    `abstract Collection<T>` | `getGroups()` Returns the group values
    `boolean` | `needsScores()`
    `void` | `setScorer(Scorer scorer)`

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

      `collect, doSetNextReader, getLeafCollector`

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

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

- - ### Constructor Detail

    - #### AllGroupsCollector

          public AllGroupsCollector()

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

      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

    - #### setScorer

          public void setScorer(Scorer scorer)
                         throws IOException

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

    - #### needsScores

          public boolean needsScores()

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