## org.apache.lucene.search.grouping.term
Class TermDistinctValuesCollector

    java.lang.Object
      org.apache.lucene.search.Collector
          org.apache.lucene.search.grouping.AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>
              org.apache.lucene.search.grouping.term.TermDistinctValuesCollector

    public class TermDistinctValuesCollector

extends AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>

A term based implementation of `AbstractDistinctValuesCollector` that relies on `SortedDocValues` to count the distinct values per group.

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

Nested Class Summary
`static class` `TermDistinctValuesCollector.GroupCount` Holds distinct values for a single group.

Constructor Summary
`TermDistinctValuesCollector(String groupField, String countField, Collection<SearchGroup<BytesRef>> groups)` Constructs `TermDistinctValuesCollector` instance.

Method Summary
`void` `collect(int doc)`
`List<TermDistinctValuesCollector.GroupCount>` `getGroups()` Returns all unique values for each top N group.
`void` `setNextReader(AtomicReaderContext context)`

Methods inherited from class org.apache.lucene.search.grouping.AbstractDistinctValuesCollector
`acceptsDocsOutOfOrder, setScorer`

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

Constructor Detail

### TermDistinctValuesCollector

    public TermDistinctValuesCollector(String groupField,
                                       String countField,
                                       Collection<SearchGroup<BytesRef>> groups)

  Constructs `TermDistinctValuesCollector` instance.

  Parameters:
    `groupField` - The field to group by
    `countField` - The field to count distinct values for
    `groups` - The top N groups, collected during the first phase search

Method Detail

### collect

    public void collect(int doc)
                 throws IOException

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

### getGroups

    public List<TermDistinctValuesCollector.GroupCount> getGroups()

  Description copied from class: `AbstractDistinctValuesCollector`
  Returns all unique values for each top N group.

  Specified by:
    `getGroups` in class `AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>`
  Returns:
    all unique values for each top N group

### setNextReader

    public void setNextReader(AtomicReaderContext context)
                       throws IOException

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

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