org.apache.lucene.search.grouping.function

## Class FunctionAllGroupHeadsCollector

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.lucene.search.grouping.AllGroupHeadsCollector<MutableValue>
    - - org.apache.lucene.search.grouping.function.FunctionAllGroupHeadsCollector

- All Implemented Interfaces:
    Collector, LeafCollector

      public class FunctionAllGroupHeadsCollector
      extends AllGroupHeadsCollector<MutableValue>

  An implementation of `AllGroupHeadsCollector` for retrieving the most relevant groups when grouping by `ValueSource`.
  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
    --- | ---
    `class` | `FunctionAllGroupHeadsCollector.FunctionGroupHead` Holds current head document for a single group.

    - ### Nested classes/interfaces inherited from class org.apache.lucene.search.grouping.AllGroupHeadsCollector

      `AllGroupHeadsCollector.GroupHead<T>, AllGroupHeadsCollector.TemporalResult`

  - ### Field Summary

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

      `compIDXEnd, reversed, temporalResult`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doSetNextReader(LeafReaderContext context)`
    `protected Collection<FunctionAllGroupHeadsCollector.FunctionGroupHead>` | `getCollectedGroupHeads()` Returns the collected group heads.
    `boolean` | `needsScores()`
    `protected void` | `retrieveGroupHeadAndAddIfNotExist(int doc)` Returns the group head and puts it into `AllGroupHeadsCollector.temporalResult`.
    `void` | `setScorer(Scorer scorer)`

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

      `collect, groupHeadsSize, retrieveGroupHeads, retrieveGroupHeads`

    - ### 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

    - #### FunctionAllGroupHeadsCollector

          public FunctionAllGroupHeadsCollector(ValueSource groupBy,
                                                Map<?,?> vsContext,
                                                Sort sortWithinGroup)

      Constructs a `FunctionAllGroupHeadsCollector` instance.
      Parameters:
        `groupBy` - The `ValueSource` to group by
        `vsContext` - The ValueSource context
        `sortWithinGroup` - The sort within a group

  - ### Method Detail

    - #### retrieveGroupHeadAndAddIfNotExist

          protected void retrieveGroupHeadAndAddIfNotExist(int doc)
                                                    throws IOException

      Description copied from class: `AllGroupHeadsCollector`
      Returns the group head and puts it into `AllGroupHeadsCollector.temporalResult`. If the group head wasn't encountered before then it will be added to the collected group heads.

      The `AllGroupHeadsCollector.TemporalResult.stop` property will be `true` if the group head wasn't encountered before otherwise `false`.

      Specified by:
        `retrieveGroupHeadAndAddIfNotExist` in class `AllGroupHeadsCollector<MutableValue>`
      Parameters:
        `doc` - The document to retrieve the group head for.
      Throws:
        `IOException` - If I/O related errors occur

    - #### getCollectedGroupHeads

          protected Collection<FunctionAllGroupHeadsCollector.FunctionGroupHead> getCollectedGroupHeads()

      Description copied from class: `AllGroupHeadsCollector`
      Returns the collected group heads. Subsequent calls should return the same group heads.
      Specified by:
        `getCollectedGroupHeads` in class `AllGroupHeadsCollector<MutableValue>`
      Returns:
        the collected group heads

    - #### setScorer

          public void setScorer(Scorer scorer)
                         throws IOException

      Specified by:
        `setScorer` in interface `LeafCollector`
      Overrides:
        `setScorer` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### doSetNextReader

          protected void doSetNextReader(LeafReaderContext context)
                                  throws IOException

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

    - #### needsScores

          public boolean needsScores()

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