You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Eric Grobler <im...@googlemail.com> on 2012/02/16 01:51:35 UTC

Spatial Search and faceting

Hi Solr community,

I am doing a spatial search and then do a facet by city.
Is it possible to then sort the faceted cities by distance?

We would like to display the hits per city, but sort them by distance.

Thanks & Regards
Ericz

q=iphone
fq={!bbox}
sfield=geopoint
pt=49.594857,8.468614
d=50
fl=id,description,city,geopoint

facet=true
facet.field=city
f.city.facet.limit=10
f.city.facet.sort=count //geodist() asc

Re: Spatial Search and faceting

Posted by Eric Grobler <im...@googlemail.com>.
Hi William,

Thanks for the feedback.

I will try the group query and see how the performance with 2 queries is.

Best Regards
Ericz

On Thu, Feb 16, 2012 at 4:06 AM, William Bell <bi...@gmail.com> wrote:

> One way to do it is to group by city and then sort=geodist() asc
>
> select?group=true&group.field=city&sort=geodist() desc&rows=10&fl=city
>
> It might require 2 calls to SOLR to get it the way you want.
>
> On Wed, Feb 15, 2012 at 5:51 PM, Eric Grobler <im...@googlemail.com>
> wrote:
> > Hi Solr community,
> >
> > I am doing a spatial search and then do a facet by city.
> > Is it possible to then sort the faceted cities by distance?
> >
> > We would like to display the hits per city, but sort them by distance.
> >
> > Thanks & Regards
> > Ericz
> >
> > q=iphone
> > fq={!bbox}
> > sfield=geopoint
> > pt=49.594857,8.468614
> > d=50
> > fl=id,description,city,geopoint
> >
> > facet=true
> > facet.field=city
> > f.city.facet.limit=10
> > f.city.facet.sort=count //geodist() asc
>
>
>
> --
> Bill Bell
> billnbell@gmail.com
> cell 720-256-8076
>

Re: Spatial Search and faceting

Posted by William Bell <bi...@gmail.com>.
One way to do it is to group by city and then sort=geodist() asc

select?group=true&group.field=city&sort=geodist() desc&rows=10&fl=city

It might require 2 calls to SOLR to get it the way you want.

On Wed, Feb 15, 2012 at 5:51 PM, Eric Grobler <im...@googlemail.com> wrote:
> Hi Solr community,
>
> I am doing a spatial search and then do a facet by city.
> Is it possible to then sort the faceted cities by distance?
>
> We would like to display the hits per city, but sort them by distance.
>
> Thanks & Regards
> Ericz
>
> q=iphone
> fq={!bbox}
> sfield=geopoint
> pt=49.594857,8.468614
> d=50
> fl=id,description,city,geopoint
>
> facet=true
> facet.field=city
> f.city.facet.limit=10
> f.city.facet.sort=count //geodist() asc



-- 
Bill Bell
billnbell@gmail.com
cell 720-256-8076