org.apache.lucene.search.grouping.function

## Class FunctionAllGroupsCollector

- java.lang.Object
- - org.apache.lucene.search.Collector
  - - org.apache.lucene.search.grouping.AbstractAllGroupsCollector<MutableValue>
    - - org.apache.lucene.search.grouping.function.FunctionAllGroupsCollector

    public class FunctionAllGroupsCollector
    extends AbstractAllGroupsCollector<MutableValue>

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.

Implementation detail: Uses `ValueSource` and `FunctionValues` to retrieve the field values to group by.

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

### Constructor Summary

Constructors
Constructor and Description
`FunctionAllGroupsCollector(ValueSource groupBy, Map<?,?> vsContext)` Constructs a `FunctionAllGroupsCollector` instance.

### Method Summary

Methods
`void` `collect(int doc)`
`Collection<MutableValue>` `getGroups()` Returns the group values This is an unordered collections of group values.
`void` `setNextReader(AtomicReaderContext context)`

### Methods inherited from class org.apache.lucene.search.grouping.AbstractAllGroupsCollector

`acceptsDocsOutOfOrder, getGroupCount, setScorer`

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

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

### Constructor Detail

#### FunctionAllGroupsCollector

    public FunctionAllGroupsCollector(ValueSource groupBy,
                              Map<?,?> vsContext)

Constructs a `FunctionAllGroupsCollector` instance.

Parameters:
  `groupBy` - The `ValueSource` to group by
  `vsContext` - The ValueSource context

### Method Detail

#### getGroups

    public Collection<MutableValue> getGroups()

Description copied from class: `AbstractAllGroupsCollector`
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.

Specified by:
  `getGroups` in class `AbstractAllGroupsCollector<MutableValue>`
Returns:
  the group values

#### collect

    public void collect(int doc)
                 throws IOException

Specified by:
  `collect` in class `Collector`
Throws:
  `IOException`

#### setNextReader

    public void setNextReader(AtomicReaderContext context)
                       throws IOException

Specified by:
  `setNextReader` in class `Collector`
Throws:
  `IOException`