org.apache.lucene.search.grouping

## Class Grouper<T>

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

- Type Parameters:
    `T` - the type the group value
  Direct Known Subclasses:
    FunctionGrouper, TermGrouper

      public abstract class Grouper<T>
      extends Object

  A factory object to create first and second-pass collectors, run by a `GroupingSearch`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Grouper()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract AllGroupsCollector<T>` | `getAllGroupsCollector()` Create an `AllGroupsCollector`
    `abstract FirstPassGroupingCollector<T>` | `getFirstPassCollector(Sort sort, int count)` Create a first-pass collector
    `abstract AllGroupHeadsCollector<T>` | `getGroupHeadsCollector(Sort sort)` Create an `AllGroupHeadsCollector`
    `abstract SecondPassGroupingCollector<T>` | `getSecondPassCollector(Collection<SearchGroup<T>> groups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields)` Create a second-pass collector

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

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

- - ### Constructor Detail

    - #### Grouper

          public Grouper()

  - ### Method Detail

    - #### getFirstPassCollector

          public abstract FirstPassGroupingCollector<T> getFirstPassCollector(Sort sort,
                                                                              int count)
                                                                       throws IOException

      Create a first-pass collector
      Parameters:
        `sort` - the order in which groups should be returned
        `count` - how many groups to return
      Throws:
        `IOException`

    - #### getAllGroupsCollector

          public abstract AllGroupsCollector<T> getAllGroupsCollector()

      Create an `AllGroupsCollector`

    - #### getGroupHeadsCollector

          public abstract AllGroupHeadsCollector<T> getGroupHeadsCollector(Sort sort)

      Create an `AllGroupHeadsCollector`
      Parameters:
        `sort` - a within-group sort order to determine which doc is the group head

    - #### getSecondPassCollector

          public abstract SecondPassGroupingCollector<T> getSecondPassCollector(Collection<SearchGroup<T>> groups,
                                                                                Sort groupSort,
                                                                                Sort withinGroupSort,
                                                                                int maxDocsPerGroup,
                                                                                boolean getScores,
                                                                                boolean getMaxScores,
                                                                                boolean fillSortFields)
                                                                         throws IOException

      Create a second-pass collector
      Throws:
        `IOException`

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