SOLR-11943: Update RefGuide for latlonVectors and haversineMeters functions.

This commit is contained in:
Joel Bernstein 2018-09-09 20:44:25 -04:00
parent f406ff91a8
commit 304836e675
3 changed files with 69 additions and 6 deletions

View File

@ -179,10 +179,11 @@ numeric arrays or a *distance matrix* for the columns of a matrix.
There are four distance measure functions that return a function
that performs the actual distance calculation:
* euclidean() (default)
* manhattan()
* canberra()
* earthMovers()
* euclidean (default)
* manhattan
* canberra
* earthMovers
* haversineMeters (Geospatial distance measure)
The distance measure functions can be used with all machine learning functions
that support different distance measures.

View File

@ -38,7 +38,7 @@ record in your Solr Cloud cluster computable.
*<<matrix-math.adoc#matrix-math,Matrix Math>>*: Matrix creation, manipulation, and matrix math.
*<<vectorization.adoc#vectorization,Streams and Vectorization>>*: Retrieving streams and vectorizing numeric fields.
*<<vectorization.adoc#vectorization,Streams and Vectorization>>*: Retrieving streams and vectorizing numeric and lat/long point fields.
*<<term-vectors.adoc#term-vectors,Text Analysis and Term Vectors>>*: Using math expressions for text analysis and TF-IDF term vectors.

View File

@ -240,4 +240,66 @@ When this expression is sent to the /stream handler it responds with:
]
}
}
----
----
== Latitude / Longitude Vectors
The `latlonVectors` function wraps a list of tuples and parses a lat/long location field into
a matrix of lat/long vectors. Each row in the matrix is a vector that contains the lat/long
pair for the corresponding tuple in the list. The column labels for the matrix are
automatically set to the *id* field in the tuples. The the lat/lon matrix can then be operated
on by machine learning functions using the `haversineMeters` distance measure.
The `latlonVectors` function takes two parameters: a list of tuples and a named parameter called
*field*. The field parameter tells the `latlonVectors` function which field to parse the lat/lon
vectors from.
Below is an example of the `latlonVectors`.
[source,text]
----
let(a=random(collection1, q="*:*", fl="id, loc_p", rows="5"),
b=latlonVectors(a, field="loc_p"))
----
When this expression is sent to the /stream handler it responds with:
[source,json]
----
{
"result-set": {
"docs": [
{
"b": [
[
42.87183530723629,
76.74102353397778
],
[
42.91372904094898,
76.72874889228416
],
[
42.911528804897564,
76.70537292977619
],
[
42.91143870500213,
76.74749913047408
],
[
42.904666267479705,
76.73933236046092
]
]
},
{
"EOF": true,
"RESPONSE_TIME": 21
}
]
}
}
----