Package org.apache.lucene.search

# Record Class TotalHits

java.lang.Object
java.lang.Record
org.apache.lucene.search.TotalHits

Record Components:
  `value` - The value of the total hit count. Must be interpreted in the context of `relation`.
  `relation` - Whether `value` is the exact hit count, in which case `relation` is equal to `TotalHits.Relation.EQUAL_TO`, or a lower bound of the total hit count, in which case `relation` is equal to `TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO`.

public record TotalHits(long value, TotalHits.Relation relation) extends Record
Description of the total number of hits of a query. The total hit count can't generally be computed accurately without visiting all matches, which is costly for queries that match lots of documents. Given that it is often enough to have a lower bounds of the number of hits, such as "there are more than 1000 hits", Lucene has options to stop counting as soon as a threshold has been reached in order to improve query times.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `TotalHits.Relation`
  How the `value` should be interpreted.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TotalHits(long value, TotalHits.Relation relation)`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `TotalHits.Relation`
  `relation()`
  Returns the value of the `relation` record component.
  `String`
  `toString()`
  Returns a string representation of this record class.
  `long`
  `value()`
  Returns the value of the `value` record component.

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

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

- ## Constructor Details

  - ### TotalHits

    public TotalHits(long value, TotalHits.Relation relation)
    Sole constructor.

- ## Method Details

  - ### toString

    public 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.

  - ### value

    public long value()
    Returns the value of the `value` record component.
    Returns:
      the value of the `value` record component

  - ### relation

    public TotalHits.Relation relation()
    Returns the value of the `relation` record component.
    Returns:
      the value of the `relation` record component