Reduction functions reduce the values of sources and/or unreduced mapping functions for every Solr Document to a single value.
Below is a list of all reduction functions provided by the Analytics Component. These can be combined using mapping functions to implement more complex functionality.
Counting Reductions
Count
The number of existing values for an expression. For singlevalued expressions, this is equivalent to docCount
. If no expression is given, the number of matching documents is returned.
count()
=> < Single Long >
count(< T >)
=> < Single Long >
Doc Count
The number of documents for which an expression has existing values. For singlevalued expressions, this is equivalent to count
. If no expression is given, the number of matching documents is returned.
doc_count()
=> < Single Long >
doc_count(< T >)
=> < Single Long >
Missing
The number of documents for which an expression has no existing value.
missing(< T >)
=> < Single Long >
Unique
The number of unique values for an expression. This function accepts Numeric
, Date
and String
expressions.
unique(< T >)
=> < Single Long >
Math Reductions
Sum
Returns the sum of all values for the expression.
sum(< Double >)
=> < Single Double >
Variance
Returns the variance of all values for the expression.
variance(< Double >)
=> < Single Double >
Standard Deviation
Returns the standard deviation of all values for the expression.
stddev(< Double >)
=> < Single Double >
Mean
Returns the arithmetic mean of all values for the expression.
mean(< Double >)
=> < Single Double >
Weighted Mean
Returns the arithmetic mean of all values for the second expression weighted by the values of the first expression.
wmean(< Double >, < Double >)
=> < Single Double >
Note

The expressions must satisfy the rules for mult function parameters. 
Ordering Reductions
Minimum
Returns the minimum value for the expression. This function accepts Numeric
, Date
and String
expressions.
min(< T >)
=> < Single T >
Maximum
Returns the maximum value for the expression. This function accepts Numeric
, Date
and String
expressions.
max(< T >)
=> < Single T >
Median
Returns the median of all values for the expression. This function accepts Numeric
and Date
expressions.
median(< T >)
=> < Single T >
Percentile
Calculates the given percentile of all values for the expression. This function accepts Numeric
, Date
and String
expressions for the 2^{nd} parameter.
The percentile, given as the 1^{st} parameter, must be a constant double between [0, 100).
percentile(<Constant Double>, < T >)
=> < Single T >
Ordinal
Calculates the given ordinal of all values for the expression. This function accepts Numeric
, Date
and String
expressions for the 2^{nd} parameter. The ordinal, given as the 1^{st} parameter, must be a constant integer. 0 is not accepted as an ordinal value.
If the ordinal is positive, the returned value will be the n^{th} smallest value.
If the ordinal is negative, the returned value will be the n^{th} largest value.
ordinal(<Constant Int>, < T >)
=> < Single T >