You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/09/17 10:08:53 UTC

[08/44] lucene-solr:jira/solr-12709: SOLR-11943: Update RefGuide for latlonVectors and haversineMeters functions.

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


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

Branch: refs/heads/jira/solr-12709
Commit: 304836e6759175e9541a9218125f44cf56ca106e
Parents: f406ff9
Author: Joel Bernstein <jb...@apache.org>
Authored: Sun Sep 9 20:44:25 2018 -0400
Committer: Joel Bernstein <jb...@apache.org>
Committed: Sun Sep 9 20:44:25 2018 -0400

----------------------------------------------------------------------
 solr/solr-ref-guide/src/machine-learning.adoc |  9 +--
 solr/solr-ref-guide/src/math-expressions.adoc |  2 +-
 solr/solr-ref-guide/src/vectorization.adoc    | 64 +++++++++++++++++++++-
 3 files changed, 69 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/304836e6/solr/solr-ref-guide/src/machine-learning.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/machine-learning.adoc b/solr/solr-ref-guide/src/machine-learning.adoc
index ca0ae74..abbca4b 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 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.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/304836e6/solr/solr-ref-guide/src/math-expressions.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/math-expressions.adoc b/solr/solr-ref-guide/src/math-expressions.adoc
index 27600b6..de150cf 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.
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/304836e6/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 b01dcc8..09b6a01 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
+      }
+    ]
+  }
+}
+----
+
+