Erick,
  Alex asked about Solr 4 spatial, and his use-case requires it because
he's got multi-value spatial fields (multiple business office locations
per document).  So the Solr 3 spatial solution you posted won't cut it.

Alex,
  You can do this in Solr 4.0.  Use one facet.query per circle (I.e.
Distance ring away from center).  Here's an example with just one
facet.query:
http://localhost:8983/solr/collection1/select?q=*%3A*&wt=xml&facet=true&fac
et.query=geo:%22Intersects%28Circle%2845.15,-93.85%20d=0.045%29%29%22
That facet.query without url escaping is:
geo:"Intersects(Circle(45.15,-93.85 d=0.045))"
The's a 5km ring.  Repeat such facet queries for larger rings.  Each
bigger circle will of course encompass the smaller circle(s) before it.  I
suspect it's more useful to the user to see a facet count based on all
businesses within each threshold distance, versus having counts exclude
the one before basically.  But if you really want to do that, you'll have
to do that part yourself by simply subtracting one facet count from the
previous smaller ring. And to generate the filter query if they click it,
you'd then have to have a NOT clause for the smaller ring.  Ex:
  fq=geo:"Intersects(Circle(45.15,-93.85 d=0.09))" NOT
geo:"Intersects(Circle(45.15,-93.85 d=0.045))"

I'm aware it's a bit verbose.  In Solr 4.1 I've already committed a change
to allow use of {!geofilt} which will make the syntax shorter, allowing
sharing of the "pt" reference, and kilometer based distances instead of
degrees.  I'm collaborating with Ryan McKinley on
https://issues.apache.org/jira/browse/SOLR-4242 "A better spatial query
parser" including conversations off-list but feel free to participate via
commenting.

~ David Smiley

On 1/8/13 7:33 PM, "Erick Erickson" <erickerick...@gmail.com> wrote:

>For facets, doesn't
>http://localhost:8983/solr/select?wt=json&indent=true&fl=name,store&q=*:*&;
>facet=on
>&facet.query={!frange l=0 u=3}geodist(store,45.15,-93.85)
>&facet.query={!frange l=3.001 u=4}geodist(store,45.15,-93.85)
>&facet.query={!frange l=4.001 u=5}geodist(store,45.15,-93.85)
>
>work (from
>http://wiki.apache.org/solr/SpatialSearch#How_to_facet_by_distance)
>
>Although I also confess to being really unfamiliar with all things
>geodist...
>
>Best
>Erick
>
>
>On Tue, Jan 8, 2013 at 4:02 AM, Alexandre Rafalovitch
><arafa...@gmail.com>wrote:
>
>> Hello,
>>
>> I am trying to understand the new Solr 4 spatial type and what it can
>>do. I
>> sort of understand the old implementation, though also far from well.
>>
>> The use case is to have companies that has multiple offices, for which I
>> indexed locations. I then want to do a 'radar' style ranges/facets, so I
>> can say "show me everything in 100k, in 300k, etc". The wiki page for
>>old
>> implementation shows how to do it, but I am having troubles figuring
>>this
>> out for new implementation.
>>
>> Regards,
>>    Alex.
>> P.s. "Not yet possible", "wait till 4.1/5", etc are perfectly valid
>> shortest answers for me, at this stage.
>>
>> Personal blog: http://blog.outerthoughts.com/
>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>> - Time is the quality of nature that keeps events from happening all at
>> once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
>>book)
>>

Reply via email to