Search code examples
solrdatastaxdatastax-enterprisedatastax-startup

DSE Graph spatial indexes -- search with km?


I'm trying to filter vertices with point properties based on distance, similar to the example at the bottom of the Using search indexes section of the docs:

A query can find all sensors that meet the requirement of being inside the described polygon Distance that is designated as a circle with a center at (-110, 30) and a radius of 20 units with the method Geo.inside().

The "units" used for the radius are actually degrees. What I would like is to find the points within a certain radius in kilometers.

This is apparently supported by Solr, (see distanceUnitshere) and is even the default in the upstream distribution. I tried to change schema.xml to set distanceUnits=kilometers in the configuration for RPT, but then the solr core threw the following exception on reload:

org.apache.solr.common.SolrException: Must specify units="degrees" on field types with class SpatialRecursivePrefixTreeFieldType


Solution

  • In DSE5 we are running solr 4.10.3.2.1133 here the only valid type for Units in this version is degrees as we can see from the code . Units was the predecessor to distanceUnits. In the meantime you may find this helpful.