Analytics Reduction Functions
Reduction functions reduce the values of sources> and/or unreduced mapping functions for every Solr Document to a single value.
The analytics component is deprecated. We recommend looking into similar functionality found in JSON Facet API. Please notify the project if there’s functionality you need that isn’t currently covered by JSON facets. |
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 single-valued 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 single-valued 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 >
Math Reductions
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 >
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 2nd parameter.
The percentile, given as the 1st 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 2nd parameter.
The ordinal, given as the 1st 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 nth smallest value.
If the ordinal is negative, the returned value will be the nth largest value.
ordinal(<Constant Int>, < T >)
⇒ < Single T >