Return-Path: Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: (qmail 58442 invoked from network); 10 Jul 2009 20:01:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jul 2009 20:01:35 -0000 Received: (qmail 6334 invoked by uid 500); 10 Jul 2009 20:01:43 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 6244 invoked by uid 500); 10 Jul 2009 20:01:43 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 6233 invoked by uid 99); 10 Jul 2009 20:01:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jul 2009 20:01:43 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dev.and.qa@gmail.com designates 209.85.220.215 as permitted sender) Received: from [209.85.220.215] (HELO mail-fx0-f215.google.com) (209.85.220.215) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jul 2009 20:01:33 +0000 Received: by fxm11 with SMTP id 11so1043756fxm.5 for ; Fri, 10 Jul 2009 13:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=HCHxTSqjfVREZxXgb7qhTh2r/EkeBZEQ9rEAu9FGu7k=; b=Hpehs7G+EcImdncAlcGocEtL5Ia6Atrhv16Si5UcWcUmxrEheBlMundfLtv8u52j7f KfG8tWYoUy47E+FULb/wOXEUhzfPvNFJJTgrzNxOn43kBavWHwxATs7nUBtO97/FKqSd kWiBYEedBo8TJdJ81/OpnULtL3wYGplcAUaYM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=K3EM4x4gEKzNNWaML/Xai+ztK15/Di8OBqmvufnbOQOEjj1HJaNjJQw9PLgefn0ZTO 8ytypMop0yq5OJhAVlM+x2X6yFCYqF+AkLSl+QFJej/jJYF2WJFxuk0fHL5WUHS1bnVq uQlCPKG3gwgUsnihXykzb5vc6i3l4fc6FOy44= MIME-Version: 1.0 Received: by 10.239.172.3 with SMTP id y3mr185184hbe.74.1247256073344; Fri, 10 Jul 2009 13:01:13 -0700 (PDT) Date: Fri, 10 Jul 2009 16:01:13 -0400 Message-ID: <6d377b710907101301v73ba3346gbca9fb378844dede@mail.gmail.com> Subject: How to do a "reverse distance" search? From: Development Team To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=00163649a5c13215a4046e5f6fb4 X-Virus-Checked: Checked by ClamAV on apache.org --00163649a5c13215a4046e5f6fb4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 client? 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. Sincerely, Daryl. --00163649a5c13215a4046e5f6fb4--