Use the {!geofilt} param like Grant suggested. IMO, it works the best
especially on larger datasets.
Adam
Sent from my iPhone
On Feb 4, 2011, at 10:56 PM, Bill Bell <[email protected]> wrote:
> Why not just:
>
> q=*:*
> fq={!bbox}
> sfield=store
> pt=49.45031,11.077721
> d=40
> fl=store
> sort=geodist() asc
>
>
> http://localhost:8983/solr/select?q=*:*&sfield=store&pt=49.45031,11.077721&
> d=40&fq={!bbox}&sort=geodist%28%29%20asc
>
> That will sort, and filter up to 40km.
>
> No need for the
>
> fq={!func}geodist()
> sfield=store
> pt=49.45031,11.077721
>
>
> Bill
>
>
>
>
> On 2/4/11 4:30 AM, "Eric Grobler" <[email protected]> wrote:
>
>> Hi Grant,
>>
>> Thanks for the tip
>> This seems to work:
>>
>> q=*:*
>> fq={!func}geodist()
>> sfield=store
>> pt=49.45031,11.077721
>>
>> fq={!bbox}
>> sfield=store
>> pt=49.45031,11.077721
>> d=40
>>
>> fl=store
>> sort=geodist() asc
>>
>>
>> On Thu, Feb 3, 2011 at 7:46 PM, Grant Ingersoll <[email protected]>
>> wrote:
>>
>>> Use a filter query? See the {!geofilt} stuff on the wiki page. That
>>> gives
>>> you your filter to restrict down your result set, then you can sort by
>>> exact
>>> distance to get your sort of just those docs that make it through the
>>> filter.
>>>
>>>
>>> On Feb 3, 2011, at 10:24 AM, Eric Grobler wrote:
>>>
>>>> Hi Erick,
>>>>
>>>> Thanks I saw that example, but I am trying to sort by distance AND
>>> specify
>>>> the max distance in 1 query.
>>>>
>>>> The reason is:
>>>> running bbox on 2 million documents with a 20km distance takes only
>>> 200ms.
>>>> Sorting 2 million documents by distance takes over 1.5 seconds!
>>>>
>>>> So it will be much faster for solr to first filter the 20km documents
>>> and
>>>> then to sort them.
>>>>
>>>> Regards
>>>> Ericz
>>>>
>>>> On Thu, Feb 3, 2011 at 1:27 PM, Erick Erickson
>>> <[email protected]
>>>> wrote:
>>>>
>>>>> Further down that very page <G>...
>>>>>
>>>>> Here's an example of sorting by distance ascending:
>>>>>
>>>>> -
>>>>>
>>>>> ...&q=*:*&sfield=store&pt=45.15,-93.85&sort=geodist()
>>>>> asc<
>>>>>
>>>
>>> http://localhost:8983/solr/select?wt=json&indent=true&fl=name,store&q=*:*
>>> &sfield=store&pt=45.15,-93.85&sort=geodist()%20asc
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> The key is just the &sort=geodist(), I'm pretty sure that's
>>> independent
>>> of
>>>>> the bbox, but
>>>>> I could be wrong.
>>>>>
>>>>> Best
>>>>> Erick
>>>>>
>>>>> On Wed, Feb 2, 2011 at 11:18 AM, Eric Grobler <
>>> [email protected]
>>>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> In http://wiki.apache.org/solr/SpatialSearch
>>>>>> there is an example of a bbox filter and a geodist function.
>>>>>>
>>>>>> Is it possible to do a bbox filter and sort by distance - combine
>>> the
>>>>> two?
>>>>>>
>>>>>> Thanks
>>>>>> Ericz
>>>>>>
>>>>>
>>>
>>> --------------------------
>>> Grant Ingersoll
>>> http://www.lucidimagination.com/
>>>
>>> Search the Lucene ecosystem docs using Solr/Lucene:
>>> http://www.lucidimagination.com/search
>>>
>>>
>
>