Package org.apache.lucene.search.grouping

# Record Class GroupDocs<T>

java.lang.Object
java.lang.Record
org.apache.lucene.search.grouping.GroupDocs<T>

Record Components:
  `score` - Overall aggregated score of this group (currently only set by join queries).
  `maxScore` - Max score in this group
  `totalHits` - Total hits within this group
  `scoreDocs` - Hits; this may be `FieldDoc` instances if the withinGroupSort sorted by fields.
  `groupValue` - The groupField value for all docs in this group; this may be null if hits did not have the groupField.
  `groupSortValues` - Matches the groupSort passed to `FirstPassGroupingCollector`.

public record GroupDocs<T>(float score, float maxScore, TotalHits totalHits, ScoreDoc[] scoreDocs, T groupValue, Object[] groupSortValues) extends Record
Represents one group in the results.

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

## Constructor Summary

Constructors
Constructor
Description
`GroupDocs(float score, float maxScore, TotalHits totalHits, ScoreDoc[] scoreDocs, T groupValue, Object[] groupSortValues)`
Creates an instance of a `GroupDocs` record class.

## Method Summary

Modifier and Type
Method
Description
`final boolean`
`equals(Object o)`
Indicates whether some other object is "equal to" this one.
`Object[]`
`groupSortValues()`
Returns the value of the `groupSortValues` record component.
`T`
`groupValue()`
Returns the value of the `groupValue` record component.
`final int`
`hashCode()`
Returns a hash code value for this object.
`float`
`maxScore()`
Returns the value of the `maxScore` record component.
`float`
`score()`
Returns the value of the `score` record component.
`ScoreDoc[]`
`scoreDocs()`
Returns the value of the `scoreDocs` record component.
`final String`
`toString()`
Returns a string representation of this record class.
`TotalHits`
`totalHits()`
Returns the value of the `totalHits` record component.

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

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

## Constructor Details

### GroupDocs

public GroupDocs(float score, float maxScore, TotalHits totalHits, ScoreDoc[] scoreDocs, T groupValue, Object[] groupSortValues)
Creates an instance of a `GroupDocs` record class.

Parameters:
  `score` - the value for the `score` record component
  `maxScore` - the value for the `maxScore` record component
  `totalHits` - the value for the `totalHits` record component
  `scoreDocs` - the value for the `scoreDocs` record component
  `groupValue` - the value for the `groupValue` record component
  `groupSortValues` - the value for the `groupSortValues` record component

## Method Details

### toString

public final String toString()
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

Specified by:
  `toString` in class `Record`
Returns:
  a string representation of this object

### hashCode

public final int hashCode()
Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

Specified by:
  `hashCode` in class `Record`
Returns:
  a hash code value for this object

### equals

public final boolean equals(Object o)
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with `Objects::equals(Object,Object)`; primitive components are compared with '=='.

Specified by:
  `equals` in class `Record`
Parameters:
  `o` - the object with which to compare
Returns:
  `true` if this object is the same as the `o` argument; `false` otherwise.

### score

public float score()
Returns the value of the `score` record component.

Returns:
  the value of the `score` record component

### maxScore

public float maxScore()
Returns the value of the `maxScore` record component.

Returns:
  the value of the `maxScore` record component

### totalHits

public TotalHits totalHits()
Returns the value of the `totalHits` record component.

Returns:
  the value of the `totalHits` record component

### scoreDocs

public ScoreDoc[] scoreDocs()
Returns the value of the `scoreDocs` record component.

Returns:
  the value of the `scoreDocs` record component

### groupValue

public T groupValue()
Returns the value of the `groupValue` record component.

Returns:
  the value of the `groupValue` record component

### groupSortValues

public Object[] groupSortValues()
Returns the value of the `groupSortValues` record component.

Returns:
  the value of the `groupSortValues` record component