1

Is it possible to get distance returned from a geodist() filter, on a geohash field that has multiple values?

The geosort and the geodist filter are working fine, but I'm trying to get the distance between the query point and a location that was returned in the result.

I've tried http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance The second method which is : //localhost:8983/solr/select?indent=true&fl=name,store&sfield=store&pt=45.15,-93.85&sort=score%20asc&q={!func}geodist()

But it returns weird results, tested with 2 locations it returns score 9979.032, where there is ~33,000 Km between both points in reality?

What is the unit that it uses returning the distance in the score field? I assumed km, but it does not make sense, or the result is bogus, I dunno

Anyhelp would be appreciated, thanks

Omar
  • 8,374
  • 8
  • 39
  • 50

1 Answers1

2

Solr 3 does not support multi-valued geospatial fields. And you should ignore the "GeoHash" field type in particular; it's been removed from the example schema in Solr 4, by the way. To get multi-valued geospatial fields (including sorting) in Solr 3, you need to use a plugin SOLR-2155 that I developed. Solr 4 has a spatial field based on that technology.

David Smiley
  • 4,102
  • 2
  • 19
  • 18
  • I use it already, it is a brilliant plugin, but what is wrong with the getting the distance from the result. Thank you for such a great plugin – Omar Sep 21 '12 at 00:39
  • Oh you're using it already; you're welcome. But based on your results it seems there may be a bug. It should be KM. If the results are questionable then simply calculate it yourself. Look on the web for a code sample of the Haversine formula in your language of choice and you'll surely find it -- it's at most 10 lines. – David Smiley Sep 22 '12 at 03:46
  • It's almost the same as the Haversine formula results, I compared various pairs in close distance < 1km. – Omar Sep 23 '12 at 10:22