: sort=dist(2,lat,lon,55.755786,37.617633) asc : : In general results are sorted, but some documents are not in right order. : I'm using DistanceUtils.getDistanceMi(...) from lucene spatial to calculate : real distance after reading documents from Solr.
according ot the wiki for hte "dist" function... "Return the Distance between two Vectors (points) in an n-dimensional space." ..and the "2" param in your call means it's going to use the Euclidean Distance. where as DistanceUtils.getDistanceMi (allthough undocumented) suggests that it will return a distance in miles (skimming the code seems to bear this out ... it just calls getLLMDistance which calls p1.arcDistance( p2, DistanceUnits.MILES) I know very little about the spatial package, but i know enough to know that a vector distance between two arbitrary points in a two dimensional space is not the same as the distance between two points on *earth* in miles. I believe what you want to be using is the "hsin" function In older versions of SOlr Spatial support, in order for it to work with "miles on earth" you had to provide the "radius of the earth in miles" as a param ... i believe that is still possible (and how you cna get the poutput in other units, like km, or feet), but on the current trunk just specifying the points should give you the distance in miles by default. -Hoss