org.apache.solr.analytics.statistics

## Class NumericStatsCollector

- java.lang.Object
- - org.apache.solr.analytics.statistics.MinMaxStatsCollector
  - - org.apache.solr.analytics.statistics.NumericStatsCollector

- All Implemented Interfaces:
    StatsCollector

      public class NumericStatsCollector
      extends MinMaxStatsCollector

  `NumericStatsCollector` computes the sum, sum of squares, mean and standard deviation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `mean`
    `protected double` | `stddev`
    `protected double` | `sum`
    `protected double` | `sumOfSquares`

    - ### Fields inherited from class org.apache.solr.analytics.statistics.MinMaxStatsCollector

      `function, max, min, missingCount, source, statsList, value, valueCount, valueFiller`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NumericStatsCollector(ValueSource source, Set<String> statsList)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `collect(int doc)` Collect values from the value source and add to statistics.
    `void` | `compute()` After all documents have been collected, this method should be called to finalize the calculations of each statistic.
    `Comparable` | `getStat(String stat)` Return the value of the given statistic.

    - ### Methods inherited from class org.apache.solr.analytics.statistics.MinMaxStatsCollector

      `getFunction, getStatsList, getValue, setNextReader, statString, toString, valueSourceString`

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

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

- - ### Field Detail

    - #### sum

          protected double sum

    - #### sumOfSquares

          protected double sumOfSquares

    - #### mean

          protected double mean

    - #### stddev

          protected double stddev

  - ### Constructor Detail

    - #### NumericStatsCollector

          public NumericStatsCollector(ValueSource source,
                                       Set<String> statsList)

  - ### Method Detail

    - #### collect

          public void collect(int doc)

      Description copied from interface: `StatsCollector`
      Collect values from the value source and add to statistics.
      Specified by:
        `collect` in interface `StatsCollector`
      Overrides:
        `collect` in class `MinMaxStatsCollector`
      Parameters:
        `doc` - Document to collect from

    - #### getStat

          public Comparable getStat(String stat)

      Description copied from interface: `StatsCollector`
      Return the value of the given statistic.
      Specified by:
        `getStat` in interface `StatsCollector`
      Overrides:
        `getStat` in class `MinMaxStatsCollector`
      Parameters:
        `stat` - the stat
      Returns:
        a comparable

    - #### compute

          public void compute()

      Description copied from interface: `StatsCollector`
      After all documents have been collected, this method should be called to finalize the calculations of each statistic.
      Specified by:
        `compute` in interface `StatsCollector`
      Overrides:
        `compute` in class `MinMaxStatsCollector`

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