org.apache.lucene.search.grouping

## Class SearchGroup<GROUP_VALUE_TYPE>

- java.lang.Object
- - org.apache.lucene.search.grouping.SearchGroup<GROUP_VALUE_TYPE>

- Direct Known Subclasses:
    CollectedSearchGroup

      public class SearchGroup<GROUP_VALUE_TYPE>
      extends Object

  Represents a group that is found during the first pass search.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `GROUP_VALUE_TYPE` | `groupValue` The value that defines this group
    `Object[]` | `sortValues` The sort values used during sorting.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearchGroup()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `static <T> Collection<SearchGroup<T>>` | `merge(List<Collection<SearchGroup<T>>> topGroups, int offset, int topN, Sort groupSort)` Merges multiple collections of top groups, for example obtained from separate index shards.
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### groupValue

          public GROUP_VALUE_TYPE groupValue

      The value that defines this group

    - #### sortValues

          public Object[] sortValues

      The sort values used during sorting. These are the groupSort field values of the highest rank document (by the groupSort) within the group. Can be `null` if `fillFields=false` had been passed to `AbstractFirstPassGroupingCollector.getTopGroups(int, boolean)`

  - ### Constructor Detail

    - #### SearchGroup

          public SearchGroup()

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### merge

          public static <T> Collection<SearchGroup<T>> merge(List<Collection<SearchGroup<T>>> topGroups,
                                             int offset,
                                             int topN,
                                             Sort groupSort)
                                                  throws IOException

      Merges multiple collections of top groups, for example obtained from separate index shards. The provided groupSort must match how the groups were sorted, and the provided SearchGroups must have been computed with fillFields=true passed to `AbstractFirstPassGroupingCollector.getTopGroups(int, boolean)`.

      NOTE: this returns null if the topGroups is empty.

      Throws:
        `IOException`

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