org.apache.lucene.search.grouping.function

## Class FunctionFirstPassGroupingCollector

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.lucene.search.grouping.FirstPassGroupingCollector<MutableValue>
    - - org.apache.lucene.search.grouping.function.FunctionFirstPassGroupingCollector

- All Implemented Interfaces:
    Collector, LeafCollector

      public class FunctionFirstPassGroupingCollector
      extends FirstPassGroupingCollector<MutableValue>

  Concrete implementation of `FirstPassGroupingCollector` that groups based on `ValueSource` instances.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

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

      `orderedGroups`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FunctionFirstPassGroupingCollector(ValueSource groupByVS, Map<?,?> vsContext, Sort groupSort, int topNGroups)` Creates a first pass collector.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected MutableValue` | `copyDocGroupValue(MutableValue groupValue, MutableValue reuse)` Returns a copy of the specified group value by creating a new instance and copying the value from the specified groupValue in the new instance.
    `protected void` | `doSetNextReader(LeafReaderContext readerContext)`
    `protected MutableValue` | `getDocGroupValue(int doc)` Returns the group value for the specified doc.

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

      `collect, getTopGroups, 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

    - #### FunctionFirstPassGroupingCollector

          public FunctionFirstPassGroupingCollector(ValueSource groupByVS,
                                                    Map<?,?> vsContext,
                                                    Sort groupSort,
                                                    int topNGroups)
                                             throws IOException

      Creates a first pass collector.
      Parameters:
        `groupByVS` - The `ValueSource` instance to group by
        `vsContext` - The ValueSource context
        `groupSort` - The `Sort` used to sort the groups. The top sorted document within each group according to groupSort, determines how that group sorts against other groups. This must be non-null, ie, if you want to groupSort by relevance use Sort.RELEVANCE.
        `topNGroups` - How many top groups to keep.
      Throws:
        `IOException` - When I/O related errors occur

  - ### Method Detail

    - #### getDocGroupValue

          protected MutableValue getDocGroupValue(int doc)

      Description copied from class: `FirstPassGroupingCollector`
      Returns the group value for the specified doc.
      Specified by:
        `getDocGroupValue` in class `FirstPassGroupingCollector<MutableValue>`
      Parameters:
        `doc` - The specified doc
      Returns:
        the group value for the specified doc

    - #### copyDocGroupValue

          protected MutableValue copyDocGroupValue(MutableValue groupValue,
                                                   MutableValue reuse)

      Description copied from class: `FirstPassGroupingCollector`
      Returns a copy of the specified group value by creating a new instance and copying the value from the specified groupValue in the new instance. Or optionally the reuse argument can be used to copy the group value in.
      Specified by:
        `copyDocGroupValue` in class `FirstPassGroupingCollector<MutableValue>`
      Parameters:
        `groupValue` - The group value to copy
        `reuse` - Optionally a reuse instance to prevent a new instance creation
      Returns:
        a copy of the specified group value

    - #### doSetNextReader

          protected void doSetNextReader(LeafReaderContext readerContext)
                                  throws IOException

      Overrides:
        `doSetNextReader` in class `FirstPassGroupingCollector<MutableValue>`
      Throws:
        `IOException`

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