You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2018/11/08 20:29:26 UTC

lucene-solr:master: SOLR-12913: Add ltrim and rtrim to the Math Expressions User Guide

Repository: lucene-solr
Updated Branches:
  refs/heads/master 243a8a668 -> 01397c1b8


SOLR-12913: Add ltrim and rtrim to the Math Expressions User Guide


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/01397c1b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/01397c1b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/01397c1b

Branch: refs/heads/master
Commit: 01397c1b88883593d741e2c744d316dc033a995a
Parents: 243a8a6
Author: Joel Bernstein <jb...@apache.org>
Authored: Thu Nov 8 15:29:15 2018 -0500
Committer: Joel Bernstein <jb...@apache.org>
Committed: Thu Nov 8 15:29:15 2018 -0500

----------------------------------------------------------------------
 solr/solr-ref-guide/src/vector-math.adoc   | 35 +++++++++++++++++++++++++
 solr/solr-ref-guide/src/vectorization.adoc |  8 +++---
 2 files changed, 39 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/01397c1b/solr/solr-ref-guide/src/vector-math.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/vector-math.adoc b/solr/solr-ref-guide/src/vector-math.adoc
index 6171d77..cb4ef1d 100644
--- a/solr/solr-ref-guide/src/vector-math.adoc
+++ b/solr/solr-ref-guide/src/vector-math.adoc
@@ -143,6 +143,41 @@ When this expression is sent to the `/stream` handler it responds with:
 }
 ----
 
+Elements of an array can be trimmed using the `ltrim` (left trim) and `rtrim` (right trim) functions.
+The `ltrim` and `rtrim` functions remove a specific number of elements from the left or right of an array.
+
+The example below shows the `lrtim` function trimming the first 2 elements of an array:
+
+[source,text]
+----
+ltrim(array(0,1,2,3,4,5,6))
+----
+
+When this expression is sent to the `/stream` handler it responds with:
+
+[source,json]
+----
+{
+  "result-set": {
+    "docs": [
+      {
+        "return-value": [
+          2,
+          3,
+          4,
+          5,
+          6,
+        ]
+      },
+      {
+        "EOF": true,
+        "RESPONSE_TIME": 1
+      }
+    ]
+  }
+}
+----
+
 == Vector Sorting
 
 An array can be sorted in natural ascending order with the `asc` function.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/01397c1b/solr/solr-ref-guide/src/vectorization.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/vectorization.adoc b/solr/solr-ref-guide/src/vectorization.adoc
index 9483cc3..5c08a58 100644
--- a/solr/solr-ref-guide/src/vectorization.adoc
+++ b/solr/solr-ref-guide/src/vectorization.adoc
@@ -250,15 +250,15 @@ When this expression is sent to the `/stream` handler it responds with:
 
 == Facet Co-occurrence Matrices
 
-The `facet` function can be used to quickly perform mulit-dimension aggregations of categorical data from
+The `facet` function can be used to quickly perform multi-dimension aggregations of categorical data from
 records stored in a Solr Cloud collection. These multi-dimension aggregations can represent co-occurrence
 counts for the values in the dimensions. The `pivot` function can be used to move two dimensional
 aggregations into a co-occurrence matrix. The co-occurrence matrix can then be clustered or analyzed for
 correlations to learn about the hidden connections within the data.
 
-In the example below th `facet` expression is used to generate a two dimensional faceted aggregation.
+In the example below the `facet` expression is used to generate a two dimensional faceted aggregation.
 The first dimension is the US State that a car was purchased in and the second dimension is the car model.
-The two dimensional facet generates the co-occurrence counts for the number of times a particular car model
+This two dimensional facet generates the co-occurrence counts for the number of times a particular car model
 was purchased in a particular state.
 
 
@@ -311,7 +311,7 @@ When this expression is sent to the `/stream` handler it responds with:
 The `pivot` function can be used to move the facet results into a co-occurrence matrix. In the example below
 The `pivot` function is used to create a matrix where the rows of the matrix are the US States (state) and the
 columns of the matrix are the car models (model). The values in the matrix are the co-occurrence counts (count(*))
- from facet results.  Once the co-occurrence matrix has been created the US States can be clustered
+ from the facet results.  Once the co-occurrence matrix has been created the US States can be clustered
 by car model, or the matrix can be transposed and car models can be clustered by the US States
 where they were bought.