From 659aed2de185c67d4f56618af2626266ed5383d9 Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Mon, 27 Aug 2018 16:10:15 -0400 Subject: [PATCH] SOLR-12702: Add math expression userguid documentation --- solr/solr-ref-guide/src/statistics.adoc | 38 +++++++++++++++++++++++++ solr/solr-ref-guide/src/variables.adoc | 4 +-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/solr/solr-ref-guide/src/statistics.adoc b/solr/solr-ref-guide/src/statistics.adoc index 74da76b7960..7d3ea94468c 100644 --- a/solr/solr-ref-guide/src/statistics.adoc +++ b/solr/solr-ref-guide/src/statistics.adoc @@ -573,3 +573,41 @@ When this expression is sent to the /stream handler it responds with: } } ---- + +== Z-scores + +The `zscores` function converts a numeric array to an array of z-scores. The z-score +is the number of standard deviations a number is from the mean. + +The example below computes the z-scores for the values in an array. + + +[source,text] +---- +let(a=array(1,2,3), + b=zscores(a)) +---- + +When this expression is sent to the /stream handler it responds with: + +[source,json] +---- +{ + "result-set": { + "docs": [ + { + "b": [ + -1, + 0, + 1 + ] + }, + { + "EOF": true, + "RESPONSE_TIME": 27 + } + ] + } +} +---- + diff --git a/solr/solr-ref-guide/src/variables.adoc b/solr/solr-ref-guide/src/variables.adoc index f1ac26c7956..99ac75028f1 100644 --- a/solr/solr-ref-guide/src/variables.adoc +++ b/solr/solr-ref-guide/src/variables.adoc @@ -157,7 +157,7 @@ The `putCache` function adds a variable to the cache. In the example below an array is cached in the *workspace* workspace1 and bound to the *key* key1. The workspace allows different users to cache -objects in their own workspace. The`putCache` function returns +objects in their own workspace. The `putCache` function returns the variable that was added to the cache. [source,text] @@ -213,7 +213,7 @@ responds with: "result-set": { "docs": [ { - "d": [ + "a": [ 11, 22, 33