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 Aman Tandon <am...@gmail.com> on 2014/05/26 14:31:28 UTC

sort by spatial distance in faceting

Hi,

Is it possible to sort the results return on faceting by geo spatial
distance instead of result count.

Currently i am faceting on city, which returns me the top facets on behalf
of the docs matched for that particular city.

e.g.:
Delhi,400
Noida, 380
.
.
.
etc.

If the user selects the city then the facets should be according to the geo
spatial distance instead of results, Is it possible with the solr 4.7.x.?

With Regards
Aman Tandon

Re: sort by spatial distance in faceting

Posted by Aman Tandon <am...@gmail.com>.
No, i will try it after getting the some deep knowledge, because i am just
a beginner it will take some time :)
Thanks for the help david.

With Regards
Aman Tandon


On Wed, Jun 4, 2014 at 6:49 PM, david.w.smiley@gmail.com <
david.w.smiley@gmail.com> wrote:

> Did my suggestion work out?
>
> RE contributing — most people start out with making improvements needed for
> their application.  Alternatively you could look at some of the open issues
> in JIRA that have the “spatial” or “modules/spatial” component (for Solr or
> Lucene, respectively).  Most of the real spatial stuff is in Lucene-spatial
> & Spatial4j but some stuff is at the Solr level.  Speaking of Spatial4j;
> it’s an independent project on GitHub, used by Lucene/Solr spatial.  If you
> really like computational geometry and geodesic formulas go there and get
> on the dev list for it. It’s issues are tracked separately.
>
> ~ David Smiley
> Freelance Apache Lucene/Solr Search Consultant/Developer
> http://www.linkedin.com/in/davidwsmiley
>
>
> On Wed, Jun 4, 2014 at 7:45 AM, Aman Tandon <am...@gmail.com>
> wrote:
>
> > Thanks David, yeah i want to contribute can you please suggest me that
> how
> > should i start to learn deeply about solr spatial, i am new in solr and i
> > really want to contribute here :)
> >
> > Any help will be really appreciated.
> >
> > @David Sorry for the late reply.
> >
> > With Regards
> > Aman Tandon
> >
> >
> > On Tue, May 27, 2014 at 9:36 AM, david.w.smiley@gmail.com <
> > david.w.smiley@gmail.com> wrote:
> >
> > > Hi Aman,
> > >
> > > That’s an interesting feature request that I haven’t heard before.
> > >
> > > First reaction:  Helliosearch (a fork of Solr that is kept up to date
> > with
> > > changes from Solr) is extremely close to supporting such a thing
> because
> > it
> > > supports sorting facets by Helliosearch specific aggregation functions.
> > > http://heliosearch.org/solr-facet-functions/   However, none of its
> > > aggregation functions are spatial oriented.  If this feature is
> important
> > > enough to you, you could very well add it.  It would likely involve
> > > encoding the coordinate into the place name to avoid unnecessary
> > redundant
> > > calculations that would be needed if another field were used.
> > >
> > > Second reaction: You could do a secondary search just for these facet
> > > values that works using Result Grouping (AKA Field Collapsing). Add to
> > each
> > > document the coordinates of the city indexed using a LatLonType field.
> >  On
> > > this request, sort the documents using geodist(), and group on the city
> > > name.  Perhaps you can even get away with returning no documents per
> > group
> > > if Solr lets you — you don’t need the doc data after all.  The main
> > thing I
> > > don’t like about this approach is that it’s going to internally
> calculate
> > > the distance very redundantly since all documents for a city are going
> to
> > > have the coordinate.  Well see if it’s fast enough and give it a try.
> > >
> > > ~ David Smiley
> > > Freelance Apache Lucene/Solr Search Consultant/Developer
> > > http://www.linkedin.com/in/davidwsmiley
> > >
> > >
> > > On Mon, May 26, 2014 at 8:31 AM, Aman Tandon <amantandon.10@gmail.com
> > > >wrote:
> > >
> > > > Hi,
> > > >
> > > > Is it possible to sort the results return on faceting by geo spatial
> > > > distance instead of result count.
> > > >
> > > > Currently i am faceting on city, which returns me the top facets on
> > > behalf
> > > > of the docs matched for that particular city.
> > > >
> > > > e.g.:
> > > > Delhi,400
> > > > Noida, 380
> > > > .
> > > > .
> > > > .
> > > > etc.
> > > >
> > > > If the user selects the city then the facets should be according to
> the
> > > geo
> > > > spatial distance instead of results, Is it possible with the solr
> > 4.7.x.?
> > > >
> > > > With Regards
> > > > Aman Tandon
> > > >
> > >
> >
>

Re: sort by spatial distance in faceting

Posted by "david.w.smiley@gmail.com" <da...@gmail.com>.
Did my suggestion work out?

RE contributing — most people start out with making improvements needed for
their application.  Alternatively you could look at some of the open issues
in JIRA that have the “spatial” or “modules/spatial” component (for Solr or
Lucene, respectively).  Most of the real spatial stuff is in Lucene-spatial
& Spatial4j but some stuff is at the Solr level.  Speaking of Spatial4j;
it’s an independent project on GitHub, used by Lucene/Solr spatial.  If you
really like computational geometry and geodesic formulas go there and get
on the dev list for it. It’s issues are tracked separately.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley


On Wed, Jun 4, 2014 at 7:45 AM, Aman Tandon <am...@gmail.com> wrote:

> Thanks David, yeah i want to contribute can you please suggest me that how
> should i start to learn deeply about solr spatial, i am new in solr and i
> really want to contribute here :)
>
> Any help will be really appreciated.
>
> @David Sorry for the late reply.
>
> With Regards
> Aman Tandon
>
>
> On Tue, May 27, 2014 at 9:36 AM, david.w.smiley@gmail.com <
> david.w.smiley@gmail.com> wrote:
>
> > Hi Aman,
> >
> > That’s an interesting feature request that I haven’t heard before.
> >
> > First reaction:  Helliosearch (a fork of Solr that is kept up to date
> with
> > changes from Solr) is extremely close to supporting such a thing because
> it
> > supports sorting facets by Helliosearch specific aggregation functions.
> > http://heliosearch.org/solr-facet-functions/   However, none of its
> > aggregation functions are spatial oriented.  If this feature is important
> > enough to you, you could very well add it.  It would likely involve
> > encoding the coordinate into the place name to avoid unnecessary
> redundant
> > calculations that would be needed if another field were used.
> >
> > Second reaction: You could do a secondary search just for these facet
> > values that works using Result Grouping (AKA Field Collapsing). Add to
> each
> > document the coordinates of the city indexed using a LatLonType field.
>  On
> > this request, sort the documents using geodist(), and group on the city
> > name.  Perhaps you can even get away with returning no documents per
> group
> > if Solr lets you — you don’t need the doc data after all.  The main
> thing I
> > don’t like about this approach is that it’s going to internally calculate
> > the distance very redundantly since all documents for a city are going to
> > have the coordinate.  Well see if it’s fast enough and give it a try.
> >
> > ~ David Smiley
> > Freelance Apache Lucene/Solr Search Consultant/Developer
> > http://www.linkedin.com/in/davidwsmiley
> >
> >
> > On Mon, May 26, 2014 at 8:31 AM, Aman Tandon <amantandon.10@gmail.com
> > >wrote:
> >
> > > Hi,
> > >
> > > Is it possible to sort the results return on faceting by geo spatial
> > > distance instead of result count.
> > >
> > > Currently i am faceting on city, which returns me the top facets on
> > behalf
> > > of the docs matched for that particular city.
> > >
> > > e.g.:
> > > Delhi,400
> > > Noida, 380
> > > .
> > > .
> > > .
> > > etc.
> > >
> > > If the user selects the city then the facets should be according to the
> > geo
> > > spatial distance instead of results, Is it possible with the solr
> 4.7.x.?
> > >
> > > With Regards
> > > Aman Tandon
> > >
> >
>

Re: sort by spatial distance in faceting

Posted by Aman Tandon <am...@gmail.com>.
Thanks David, yeah i want to contribute can you please suggest me that how
should i start to learn deeply about solr spatial, i am new in solr and i
really want to contribute here :)

Any help will be really appreciated.

@David Sorry for the late reply.

With Regards
Aman Tandon


On Tue, May 27, 2014 at 9:36 AM, david.w.smiley@gmail.com <
david.w.smiley@gmail.com> wrote:

> Hi Aman,
>
> That’s an interesting feature request that I haven’t heard before.
>
> First reaction:  Helliosearch (a fork of Solr that is kept up to date with
> changes from Solr) is extremely close to supporting such a thing because it
> supports sorting facets by Helliosearch specific aggregation functions.
> http://heliosearch.org/solr-facet-functions/   However, none of its
> aggregation functions are spatial oriented.  If this feature is important
> enough to you, you could very well add it.  It would likely involve
> encoding the coordinate into the place name to avoid unnecessary redundant
> calculations that would be needed if another field were used.
>
> Second reaction: You could do a secondary search just for these facet
> values that works using Result Grouping (AKA Field Collapsing). Add to each
> document the coordinates of the city indexed using a LatLonType field.  On
> this request, sort the documents using geodist(), and group on the city
> name.  Perhaps you can even get away with returning no documents per group
> if Solr lets you — you don’t need the doc data after all.  The main thing I
> don’t like about this approach is that it’s going to internally calculate
> the distance very redundantly since all documents for a city are going to
> have the coordinate.  Well see if it’s fast enough and give it a try.
>
> ~ David Smiley
> Freelance Apache Lucene/Solr Search Consultant/Developer
> http://www.linkedin.com/in/davidwsmiley
>
>
> On Mon, May 26, 2014 at 8:31 AM, Aman Tandon <amantandon.10@gmail.com
> >wrote:
>
> > Hi,
> >
> > Is it possible to sort the results return on faceting by geo spatial
> > distance instead of result count.
> >
> > Currently i am faceting on city, which returns me the top facets on
> behalf
> > of the docs matched for that particular city.
> >
> > e.g.:
> > Delhi,400
> > Noida, 380
> > .
> > .
> > .
> > etc.
> >
> > If the user selects the city then the facets should be according to the
> geo
> > spatial distance instead of results, Is it possible with the solr 4.7.x.?
> >
> > With Regards
> > Aman Tandon
> >
>

Re: sort by spatial distance in faceting

Posted by "david.w.smiley@gmail.com" <da...@gmail.com>.
Hi Aman,

That’s an interesting feature request that I haven’t heard before.

First reaction:  Helliosearch (a fork of Solr that is kept up to date with
changes from Solr) is extremely close to supporting such a thing because it
supports sorting facets by Helliosearch specific aggregation functions.
http://heliosearch.org/solr-facet-functions/   However, none of its
aggregation functions are spatial oriented.  If this feature is important
enough to you, you could very well add it.  It would likely involve
encoding the coordinate into the place name to avoid unnecessary redundant
calculations that would be needed if another field were used.

Second reaction: You could do a secondary search just for these facet
values that works using Result Grouping (AKA Field Collapsing). Add to each
document the coordinates of the city indexed using a LatLonType field.  On
this request, sort the documents using geodist(), and group on the city
name.  Perhaps you can even get away with returning no documents per group
if Solr lets you — you don’t need the doc data after all.  The main thing I
don’t like about this approach is that it’s going to internally calculate
the distance very redundantly since all documents for a city are going to
have the coordinate.  Well see if it’s fast enough and give it a try.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley


On Mon, May 26, 2014 at 8:31 AM, Aman Tandon <am...@gmail.com>wrote:

> Hi,
>
> Is it possible to sort the results return on faceting by geo spatial
> distance instead of result count.
>
> Currently i am faceting on city, which returns me the top facets on behalf
> of the docs matched for that particular city.
>
> e.g.:
> Delhi,400
> Noida, 380
> .
> .
> .
> etc.
>
> If the user selects the city then the facets should be according to the geo
> spatial distance instead of results, Is it possible with the solr 4.7.x.?
>
> With Regards
> Aman Tandon
>