org.apache.lucene.search.grouping.term

## Class TermGrouper

- java.lang.Object
- - org.apache.lucene.search.grouping.Grouper<BytesRef>
  - - org.apache.lucene.search.grouping.term.TermGrouper

-     public class TermGrouper
      extends Grouper<BytesRef>

  Collector factory for grouping by term

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TermGrouper(String field)` Create a new TermGrouper
    `TermGrouper(String field, int initialSize)` Create a new TermGrouper

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AllGroupsCollector<BytesRef>` | `getAllGroupsCollector()` Create an `AllGroupsCollector`
    `FirstPassGroupingCollector<BytesRef>` | `getFirstPassCollector(Sort sort, int count)` Create a first-pass collector
    `AllGroupHeadsCollector<BytesRef>` | `getGroupHeadsCollector(Sort sort)` Create an `AllGroupHeadsCollector`
    `SecondPassGroupingCollector<BytesRef>` | `getSecondPassCollector(Collection<SearchGroup<BytesRef>> 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

    - #### TermGrouper

          public TermGrouper(String field)

      Create a new TermGrouper
      Parameters:
        `field` - the field to group on

    - #### TermGrouper

          public TermGrouper(String field,
                             int initialSize)

      Create a new TermGrouper
      Parameters:
        `field` - the field to group on
        `initialSize` - the initial size of various internal datastructures

  - ### Method Detail

    - #### getFirstPassCollector

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

      Description copied from class: `Grouper`
      Create a first-pass collector
      Specified by:
        `getFirstPassCollector` in class `Grouper<BytesRef>`
      Parameters:
        `sort` - the order in which groups should be returned
        `count` - how many groups to return
      Throws:
        `IOException`

    - #### getGroupHeadsCollector

          public AllGroupHeadsCollector<BytesRef> getGroupHeadsCollector(Sort sort)

      Description copied from class: `Grouper`
      Create an `AllGroupHeadsCollector`
      Specified by:
        `getGroupHeadsCollector` in class `Grouper<BytesRef>`
      Parameters:
        `sort` - a within-group sort order to determine which doc is the group head

    - #### getAllGroupsCollector

          public AllGroupsCollector<BytesRef> getAllGroupsCollector()

      Description copied from class: `Grouper`
      Create an `AllGroupsCollector`
      Specified by:
        `getAllGroupsCollector` in class `Grouper<BytesRef>`

    - #### getSecondPassCollector

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

      Description copied from class: `Grouper`
      Create a second-pass collector
      Specified by:
        `getSecondPassCollector` in class `Grouper<BytesRef>`
      Throws:
        `IOException`

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