mirror of https://github.com/apache/lucene.git
SOLR-12913: Add ltrim and rtrim to the Math Expressions User Guide
This commit is contained in:
parent
243a8a668a
commit
01397c1b88
|
@ -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
|
== Vector Sorting
|
||||||
|
|
||||||
An array can be sorted in natural ascending order with the `asc` function.
|
An array can be sorted in natural ascending order with the `asc` function.
|
||||||
|
|
|
@ -250,15 +250,15 @@ When this expression is sent to the `/stream` handler it responds with:
|
||||||
|
|
||||||
== Facet Co-occurrence Matrices
|
== 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
|
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
|
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
|
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.
|
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 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.
|
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 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
|
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(*))
|
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
|
by car model, or the matrix can be transposed and car models can be clustered by the US States
|
||||||
where they were bought.
|
where they were bought.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue