org.apache.lucene.search.grouping

## Class DistinctValuesCollector<T,R>

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.lucene.search.grouping.SecondPassGroupingCollector<T>
    - - org.apache.lucene.search.grouping.DistinctValuesCollector<T,R>

- All Implemented Interfaces:
    Collector, LeafCollector

      public class DistinctValuesCollector<T,R>
      extends SecondPassGroupingCollector<T>

  A second pass grouping collector that keeps track of distinct values for a specified field for the top N group.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DistinctValuesCollector.GroupCount<T,R>` Returned by `getGroups()`, representing the value and set of distinct values for the group.

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.search.grouping.SecondPassGroupingCollector

      `groupReducer, groups, groupSelector, totalGroupedHitCount, totalHitCount`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DistinctValuesCollector(GroupSelector<T> groupSelector, Collection<SearchGroup<T>> groups, GroupSelector<R> valueSelector)` Create a DistinctValuesCollector

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<DistinctValuesCollector.GroupCount<T,R>>` | `getGroups()` Returns all unique values for each top N group.

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

      `collect, doSetNextReader, getGroupSelector, 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

    - #### DistinctValuesCollector

          public DistinctValuesCollector(GroupSelector<T> groupSelector,
                                         Collection<SearchGroup<T>> groups,
                                         GroupSelector<R> valueSelector)

      Create a DistinctValuesCollector
      Parameters:
        `groupSelector` - the group selector to determine the top-level groups
        `groups` - the top-level groups to collect for
        `valueSelector` - a group selector to determine which values to collect per-group

  - ### Method Detail

    - #### getGroups

          public List<DistinctValuesCollector.GroupCount<T,R>> getGroups()

      Returns all unique values for each top N group.
      Returns:
        all unique values for each top N group

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