From 584b69d3f20c7afa7c9af53bf0eac0eebc140b0c Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Fri, 16 Jun 2017 14:18:54 -0400 Subject: [PATCH] Ref Guide: Add mod evaluator docs --- solr/solr-ref-guide/src/stream-evaluators.adoc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/solr/solr-ref-guide/src/stream-evaluators.adoc b/solr/solr-ref-guide/src/stream-evaluators.adoc index aec9bd2d770..bc6d13ecf89 100644 --- a/solr/solr-ref-guide/src/stream-evaluators.adoc +++ b/solr/solr-ref-guide/src/stream-evaluators.adoc @@ -212,7 +212,23 @@ if(gt(fieldA,fieldB),pow(fieldA,fieldB),pow(fieldB,fieldA)) // if fieldA > field ---- == mod -//TODO +The `mod` function returns the remainder (modulo) of the first parameter divided by the second parameter. + +=== mod Parameters + +* `Field Name | Raw Number | Number Evaluator`: Parameter 1 +* `Field Name | Raw Number | Number Evaluator`: Parameter 2 + +=== mod Syntax + +The expressions below show the various ways in which you can use the `mod` evaluator. + +[source,text] +---- +mod(100,3) // returns the remainder of 100 / 3 . +mod(100,fieldA) // returns the remainder of 100 divided by the value of fieldA. +mod(fieldA,1.4) // returns the remainder of fieldA divided by 1.4. +if(gt(fieldA,fieldB),mod(fieldA,fieldB),mod(fieldB,fieldA)) // if fieldA > fieldB then return the remainder of fieldA/fieldB, else return the remainder of fieldB/fieldA. === ceil //TODO