org.apache.lucene.search.grouping.function

## Class FunctionAllGroupsCollector

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.lucene.search.grouping.AllGroupsCollector<MutableValue>
    - - org.apache.lucene.search.grouping.function.FunctionAllGroupsCollector

- All Implemented Interfaces:
    Collector, LeafCollector

      public class FunctionAllGroupsCollector
      extends AllGroupsCollector<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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `collect(int doc)`
    `protected void` | `doSetNextReader(LeafReaderContext context)`
    `Collection<MutableValue>` | `getGroups()` Returns the group values

    - ### Methods inherited from class org.apache.lucene.search.grouping.AllGroupsCollector

      `getGroupCount, needsScores, setScorer`

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

      `getLeafCollector`

    - ### 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: `AllGroupsCollector`
      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 `AllGroupsCollector<MutableValue>`
      Returns:
        the group values

    - #### collect

          public void collect(int doc)
                       throws IOException

      Specified by:
        `collect` in interface `LeafCollector`
      Specified by:
        `collect` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### doSetNextReader

          protected void doSetNextReader(LeafReaderContext context)
                                  throws IOException

      Overrides:
        `doSetNextReader` in class `SimpleCollector`
      Throws:
        `IOException`

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