What unit of measurement does the Solr geodist() function return?

Viewed 188

I have been using solr's geodist() function to return the distance between two points, however the data that returns is always less than 1. I just want to know what unit of measurement does the geodist() method return?

1 Answers

The unit of measurement depends on the schema configuration (schema.xml) of the field your using the function on. The solr docu says for the RPT (SpatialRecursivePrefixTreeFieldType) :

distanceUnits

This is used to specify the units for distance measurements used throughout the use of this field. This can be degrees, kilometers or miles. It is applied to nearly all distance measurements involving the field: maxDistErr, distErr, d, geodist and the score when score is distance, area, or area2d. However, it doesn’t affect distances embedded in WKT strings, (e.g., BUFFER(POINT(200 10),0.2)), which are still in degrees.

distanceUnits defaults to either kilometers if geo is true, or degrees if geo is false.

https://lucene.apache.org/solr/guide/8_5/spatial-search.html#schema-configuration-for-rpt

Related