Apache Lucene open-source search software
SOLR-11943: Update RefGuide for latlonVectors and haversineMeters functions.
Joel Bernstein304836e67591
diff --git a/solr/solr-ref-guide/src/machine-learning.adoc b/solr/solr-ref-guide/src/machine-learning.adocindex ca0ae748540..abbca4b1c10 100644--- a/solr/solr-ref-guide/src/machine-learning.adoc+++ b/solr/solr-ref-guide/src/machine-learning.adoc@@ -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 functionthat 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 functionsthat support different distance measures.diff --git a/solr/solr-ref-guide/src/math-expressions.adoc b/solr/solr-ref-guide/src/math-expressions.adocindex 27600b6013c..de150cf3ac9 100644--- a/solr/solr-ref-guide/src/math-expressions.adoc+++ b/solr/solr-ref-guide/src/math-expressions.adoc@@ -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.diff --git a/solr/solr-ref-guide/src/vectorization.adoc b/solr/solr-ref-guide/src/vectorization.adocindex b01dcc8275e..09b6a0166f6 100644--- a/solr/solr-ref-guide/src/vectorization.adoc+++ b/solr/solr-ref-guide/src/vectorization.adoc@@ -240,4 +240,66 @@ When this expression is sent to the /stream handler it responds with:]}}-----\ No newline at end of file+----++== 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+ }+ ]+ }+}+----++