See http://wiki.apache.org/solr/SpatialSearch and yest use sort=geodist()+asc
This Wiki page has everything you should need\. On Tue, Mar 1, 2011 at 3:49 PM, Alexandre Rocco <alel...@gmail.com> wrote: > Hi Bill, > > I was using a different approach to sort by the distance with the dist() > function, since geodist() is not documented on the wiki ( > http://wiki.apache.org/solr/FunctionQuery) > > Tried something like: > &sort=dist(2, 45.15,-93.85, lat, lng) asc > > I made some tests with geodist() function as you pointed and got different > results. > Is it safe to assume that geodist() is the correct way of doing it? > > Also, can you clear up how can I see the distance using the "_Val_" as you > told? > > Thanks! > Alexandre > > On Tue, Mar 1, 2011 at 12:03 AM, Bill Bell <billnb...@gmail.com> wrote: > >> Use sort with geodist() to sort by distance. >> >> Getting the distance returned us documented on the wiki if you are not >> using score. see reference to _Val_ >> >> Bill Bell >> Sent from mobile >> >> >> On Feb 28, 2011, at 7:54 AM, Alexandre Rocco <alel...@gmail.com> wrote: >> >> > Hi guys, >> > >> > We are implementing a separate index on our website, that will be >> dedicated >> > to spatial search. >> > I've downloaded a build of Solr 4.0 to try the spatial features and got >> the >> > geodist working really fast. >> > >> > We now have 2 other features that will be needed on this project: >> > 1. Returning the distance from the reference point to the search hit (in >> > kilometers) >> > 2. Sorting by the distance. >> > >> > On item 2, the wiki doc points that a distance function can be used but I >> > was not able to find good info on how to accomplish it. >> > Also, returning the distance (item 1) is noted as currently being in >> > development and there is some workaround to get it. >> > >> > Anyone had experience with the spatial feature and could help with some >> > pointers on how to achieve it? >> > >> > Thanks, >> > Alexandre >> >