开发者

using miles rather than kilometers in solr spatial searches

When usin开发者_JAVA百科g solr's spatial search feature, how can I tell it to use miles rather than km when calculating values.

http://wiki.apache.org/solr/SpatialSearch


The javadoc of the class that implements geofilt says "All units are in Kilometers"

It was decided that configurable units would only complicate things.

Which means that it's up to you to do the conversions (it's trivial code really).


As of version 5.0 (released february 2015) and onwards, miles can be used as well. Also degrees can be used as units.

In the schema.xml file you would configure the <fieldType> tag as follows:

<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType/" distanceUnits="miles" />

Please note that as of version 6.0, distanceUnits is used instead of units, which is deprecated.

See the user guide for further configurations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜