Distance sort and relevancy boost
During spatial search, it may be required to sort the search results on the basis of their distance from a specific geographical location (the lat-lon coordinate). With Solr 4.0, the spatial queries seen earlier are capable of returning a distance-based score for sorting and boosting.
Let us see an example wherein spatial filtering and sorting are applied and the distance is returned as the score simultaneously. Our query will be:
http://localhost:8983/solr/collection1/select/?fl=*,score&sort=score asc&q={!geofilt score=distance sfield=store pt=28.642815,77.368413 d=20}
The query output from Solr shows four results along with their scores. Our results are sorted in ascending order on score, which represents the distance as per our query. Hence, the results that are closest to our location appear on top.
The execution of the previous query yields the following output:
In order to add user keywords to the previous Solr query, we will have to add an additional...