org.apache.lucene.search

## Class TotalHits

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

-     public final class TotalHits
      extends Object

  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 and Description
    --- | ---
    `static class` | `TotalHits.Relation` How the `value` should be interpreted.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `TotalHits.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`.
    `long` | `value` The value of the total hit count.

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### value

          public final long value

      The value of the total hit count. Must be interpreted in the context of `relation`.

    - #### relation

          public final TotalHits.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`.

  - ### Constructor Detail

    - #### TotalHits

          public TotalHits(long value,
                           TotalHits.Relation relation)

      Sole constructor.

  - ### Method Detail

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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