## org.apache.lucene.search.grouping
Class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead>

    java.lang.Object
      org.apache.lucene.search.Collector
          org.apache.lucene.search.grouping.AbstractAllGroupHeadsCollector<GH>
              org.apache.lucene.search.grouping.TermAllGroupHeadsCollector<GH>

    public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead>

extends AbstractAllGroupHeadsCollector<GH>

A base implementation of `AbstractAllGroupHeadsCollector` for retrieving the most relevant groups when grouping on a string based group field. More specifically this all concrete implementations of this base implementation use `FieldCache.StringIndex`.

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

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.lucene.search.grouping.AbstractAllGroupHeadsCollector
`AbstractAllGroupHeadsCollector.GroupHead<GROUP_VALUE_TYPE>, AbstractAllGroupHeadsCollector.TemporalResult`

Field Summary

Fields inherited from class org.apache.lucene.search.grouping.AbstractAllGroupHeadsCollector
`compIDXEnd, reversed, temporalResult`

Constructor Summary
`protected` `TermAllGroupHeadsCollector(String groupField, int numberOfSorts)`

Method Summary
`static AbstractAllGroupHeadsCollector` `create(String groupField, org.apache.lucene.search.Sort sortWithinGroup)` Creates an `AbstractAllGroupHeadsCollector` instance based on the supplied arguments.
`static AbstractAllGroupHeadsCollector` `create(String groupField, org.apache.lucene.search.Sort sortWithinGroup, int initialSize)` Creates an `AbstractAllGroupHeadsCollector` instance based on the supplied arguments.

Methods inherited from class org.apache.lucene.search.grouping.AbstractAllGroupHeadsCollector
`acceptsDocsOutOfOrder, collect, getCollectedGroupHeads, groupHeadsSize, retrieveGroupHeadAndAddIfNotExist, retrieveGroupHeads, retrieveGroupHeads`

Methods inherited from class org.apache.lucene.search.Collector
`setNextReader, setScorer`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TermAllGroupHeadsCollector

    protected TermAllGroupHeadsCollector(String groupField,
                                         int numberOfSorts)

Method Detail

### create

    public static AbstractAllGroupHeadsCollector create(String groupField,
                                                        org.apache.lucene.search.Sort sortWithinGroup)
                                                 throws IOException

  Creates an `AbstractAllGroupHeadsCollector` instance based on the supplied arguments. This factory method decides with implementation is best suited. Delegates to `create(String, org.apache.lucene.search.Sort, int)` with an initialSize of 128.

  Parameters:
    `groupField` - The field to group by
    `sortWithinGroup` - The sort within each group
  Returns:
    an `AbstractAllGroupHeadsCollector` instance based on the supplied arguments
  Throws:
    `IOException` - If I/O related errors occur

### create

    public static AbstractAllGroupHeadsCollector create(String groupField,
                                                        org.apache.lucene.search.Sort sortWithinGroup,
                                                        int initialSize)
                                                 throws IOException

  Creates an `AbstractAllGroupHeadsCollector` instance based on the supplied arguments. This factory method decides with implementation is best suited.

  Parameters:
    `groupField` - The field to group by
    `sortWithinGroup` - The sort within each group
    `initialSize` - The initial allocation size of the internal int set and group list which should roughly match the total number of expected unique groups. Be aware that the heap usage is 4 bytes * initialSize.
  Returns:
    an `AbstractAllGroupHeadsCollector` instance based on the supplied arguments
  Throws:
    `IOException` - If I/O related errors occur