Monday, July 16, 2012

Solr 3.5 spatial (geofilt) search with distance in results

Took a bit of tinkering around but here's my query.

LatLong is my field in my document with a "latitude,longitude" in it.

d=30. Distance is KMs.


http://solrserver/select?
indent=true&
fl=Name,LatLong,score&
fq={!geofilt pt=50000,-0.11111 sfield=LatLong d=30}&
sfield=LatLong&
pt= 50000,-0.11111&
sort=score asc&
q={!func}geodist()

This gets you all documents near a point (pt) and returns them with the distance stored in the score field.


0 comments:

Post a Comment