Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15491: Adding example to return distance field. (#186)

Jeff Zemerickc1d0a757fc04
diff --git a/solr/solr-ref-guide/src/spatial-search.adoc b/solr/solr-ref-guide/src/spatial-search.adoc
index 050ac409777..0ae872d97f3 100644
--- a/solr/solr-ref-guide/src/spatial-search.adoc
+++ b/solr/solr-ref-guide/src/spatial-search.adoc
@@ -210,6 +210,13 @@ Using the <<the-dismax-query-parser.adoc#,DisMax>> or <<the-extended-dismax-quer
[source,text]
&q.alt=*:*&fq={!geofilt}&sfield=store&pt=45.15,-93.85&d=50&bf=recip(geodist(),2,200,20)&sort=score desc
+=== Returning Distance as a Field
+
+To return the distance as a pseudo field you can use the `geodist()` function in the field list.
+
+[source,text]
+&fl=distance:geodist()
+
== RPT
RPT refers to either `SpatialRecursivePrefixTreeFieldType` (aka simply RPT) and an extended version: