org.apache.lucene.search.grouping

## Class GroupSelector<T>

- java.lang.Object
- - org.apache.lucene.search.grouping.GroupSelector<T>

- Type Parameters:
    `T` - the type of the group value
  Direct Known Subclasses:
    DoubleRangeGroupSelector, LongRangeGroupSelector, TermGroupSelector, ValueSourceGroupSelector

      public abstract class GroupSelector<T>
      extends Object

  Defines a group, for use by grouping collectors A GroupSelector acts as an iterator over documents. For each segment, clients should call `setNextReader(LeafReaderContext)`, and then `advanceTo(int)` for each matching document.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GroupSelector.State` What to do with the current value

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroupSelector()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract GroupSelector.State` | `advanceTo(int doc)` Advance the GroupSelector's iterator to the given document
    `abstract T` | `copyValue()`
    `abstract T` | `currentValue()` Get the group value of the current document N.B.
    `abstract void` | `setGroups(Collection<SearchGroup<T>> groups)` Set a restriction on the group values returned by this selector If the selector is positioned on a document whose group value is not contained within this set, then `advanceTo(int)` will return `GroupSelector.State.SKIP`
    `abstract void` | `setNextReader(LeafReaderContext readerContext)` Set the LeafReaderContext
    `abstract void` | `setScorer(Scorable scorer)` Set the current Scorer

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GroupSelector

          public GroupSelector()

  - ### Method Detail

    - #### setNextReader

          public abstract void setNextReader(LeafReaderContext readerContext)
                                      throws IOException

      Set the LeafReaderContext
      Throws:
        `IOException`

    - #### setScorer

          public abstract void setScorer(Scorable scorer)
                                  throws IOException

      Set the current Scorer
      Throws:
        `IOException`

    - #### advanceTo

          public abstract GroupSelector.State advanceTo(int doc)
                                                 throws IOException

      Advance the GroupSelector's iterator to the given document
      Throws:
        `IOException`

    - #### currentValue

          public abstract T currentValue()
                                  throws IOException

      Get the group value of the current document N.B. this object may be reused, for a persistent version use `copyValue()`
      Throws:
        `IOException`

    - #### copyValue

          public abstract T copyValue()
                               throws IOException

      Returns:
        a copy of the group value of the current document
      Throws:
        `IOException`

    - #### setGroups

          public abstract void setGroups(Collection<SearchGroup<T>> groups)

      Set a restriction on the group values returned by this selector If the selector is positioned on a document whose group value is not contained within this set, then `advanceTo(int)` will return `GroupSelector.State.SKIP`
      Parameters:
        `groups` - a set of `SearchGroup` objects to limit selections to

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