lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Development Team <>
Subject How to do a "reverse distance" search?
Date Fri, 10 Jul 2009 20:01:13 GMT
Hi everybody,
     Let's say we have 10,000 traveling sales-people spread throughout the
country. Each of them has has their own territory, and most of the
territories overlap (eg. 100 sales-people in a particular city alone). Each
of them also has a maximum distance they can travel. Some can travel
country-wide, others don't have a car and are limited to a 10mi radius.
     Given that we have a client at a particular location, how do we
construct a query in Solr that finds all the sales-people who can reach that

     We think we have a solution for this, but I want to know what you
think. And, in SQL this is relatively easy:  "select * from salespeople
where calc_distance(CLIENT_LAT, CLIENT_LONG, lat, long) < maxTravelDist" But
a problem is that calc_distance() is fairly expensive. If it was our
"client" that specified the distance, it would be easy to include it as part
of the search criteria in the Solr query, but unfortunately it's each
individual sales-person that specifies a distance.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message