DocValuesStats (Lucene 10.5.0 misc API)
Description: declaration: package: org.apache.lucene.misc.search, class: DocValuesStats

Package org.apache.lucene.misc.search

# Class DocValuesStats<T>

java.lang.Object
org.apache.lucene.misc.search.DocValuesStats<T>

Direct Known Subclasses:
  `DocValuesStats.NumericDocValuesStats`, `DocValuesStats.SortedDocValuesStats`, `DocValuesStats.SortedNumericDocValuesStats`, `DocValuesStats.SortedSetDocValuesStats`

public abstract class DocValuesStats<T> extends Object
Holds statistics for a DocValues field.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `DocValuesStats.DoubleDocValuesStats`
  Holds DocValues statistics for a numeric field storing `double` values.
  `static final class`
  `DocValuesStats.LongDocValuesStats`
  Holds DocValues statistics for a numeric field storing `long` values.
  `static class`
  `DocValuesStats.NumericDocValuesStats<T extends Number>`
  Holds statistics for a numeric DocValues field.
  `static class`
  `DocValuesStats.SortedDocValuesStats`
  Holds statistics for a sorted DocValues field.
  `static final class`
  `DocValuesStats.SortedDoubleDocValuesStats`
  Holds DocValues statistics for a sorted-numeric field storing `double` values.
  `static final class`
  `DocValuesStats.SortedLongDocValuesStats`
  Holds DocValues statistics for a sorted-numeric field storing `long` values.
  `static class`
  `DocValuesStats.SortedNumericDocValuesStats<T extends Number>`
  Holds statistics for a sorted-numeric DocValues field.
  `static class`
  `DocValuesStats.SortedSetDocValuesStats`
  Holds statistics for a sorted-set DocValues field.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `count`
  `protected final String`
  `field`
  `protected T`
  `max`
  `protected T`
  `min`
  `protected int`
  `missing`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `DocValuesStats(String field, T initialMin, T initialMax)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final int`
  `count()`
  The number of documents which have a value of the field.
  `protected abstract void`
  `doAccumulate(int count)`
  Called after `accumulate(int)` was processed and verified that the document has a value for the field.
  `final String`
  `field()`
  The field for which these stats were computed.
  `protected abstract boolean`
  `hasValue(int doc)`
  Returns whether the given document has a value for the requested DocValues field.
  `protected abstract boolean`
  `init(LeafReaderContext context)`
  Initializes this object with the given reader context.
  `final T`
  `max()`
  The maximum value of the field.
  `protected void`
  `merge(DocValuesStats<T> other)`
  Merges the statistics from `other` into this instance.
  `final T`
  `min()`
  The minimum value of the field.
  `final int`
  `missing()`
  The number of documents which do not have a value of the field.

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

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

- ## Field Details

  - ### missing

    protected int missing

  - ### count

    protected int count

  - ### field

    protected final String field

  - ### min

    protected T min

  - ### max

    protected T max

- ## Constructor Details

  - ### DocValuesStats

    protected DocValuesStats(String field, T initialMin, T initialMax)

- ## Method Details

  - ### doAccumulate

    protected abstract void doAccumulate(int count) throws IOException
    Called after `accumulate(int)` was processed and verified that the document has a value for the field. Implementations should update the statistics based on the value of the current document.
    Parameters:
      `count` - the updated number of documents with value for this field.
    Throws:
      `IOException`

  - ### init

    protected abstract boolean init(LeafReaderContext context) throws IOException
    Initializes this object with the given reader context. Returns whether stats can be computed for this segment (i.e. it does have the requested DocValues field).
    Throws:
      `IOException`

  - ### hasValue

    protected abstract boolean hasValue(int doc) throws IOException
    Returns whether the given document has a value for the requested DocValues field.
    Throws:
      `IOException`

  - ### merge

    protected void merge(DocValuesStats<T> other)
    Merges the statistics from `other` into this instance. After the call, this instance reflects the combined statistics of both segments as if they had been collected together. Subclasses that track additional statistics (e.g. mean, variance, sum) must override this method, call `super.merge(other)`, and combine their own fields accordingly.
    Parameters:
      `other` - the stats instance to merge into this one; must be of the same concrete type

  - ### field

    public final String field()
    The field for which these stats were computed.

  - ### count

    public final int count()
    The number of documents which have a value of the field.

  - ### missing

    public final int missing()
    The number of documents which do not have a value of the field.

  - ### min

    public final T min()
    The minimum value of the field. Undefined when `count()` is zero.

  - ### max

    public final T max()
    The maximum value of the field. Undefined when `count()` is zero.