Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Lucene and all its subprojects:

Switch to Plain View
Solr >> mail # user >> How to return the distance geo distance on solr 3.5 with bbox filtering


+
Maxim Veksler 2012-01-17, 18:06
+
Mikhail Khludnev 2012-01-18, 09:00
+
Maxim Veksler 2012-01-18, 12:46
+
Mikhail Khludnev 2012-01-18, 19:11
+
Maxim Veksler 2012-01-19, 16:29
Copy link to this message
-
Re: How to return the distance geo distance on solr 3.5 with bbox filtering
On Thu, Jan 19, 2012 at 8:29 PM, Maxim Veksler <[EMAIL PROTECTED]> wrote:

> It works. The query:
>
> *
>
> http://localhost:8983/solr/select?indent=true&fq={!bbox}&sfield=loc&pt=34.0415954,-118.298797&d=1000.0&sort=score%20asc&fq=trafficRouteId:887&q={!func}geodist()&fl=*,score&rows=1
> *
>
> works perfectly, doing all the filtering needed and returning the distance
> as score. Thank you very much for this help.
>
> As a new comer to lucene/solr I must admit the the syntax is confusing.
>
> For ex. why for the "fq" parameter

http://wiki.apache.org/solr/CommonQueryParameters#fq

> the "function name"

it's QParser, common are listed here
http://wiki.apache.org/solr/SolrQuerySyntax#Other_built-in_useful_query_parsers
bbox
is http://wiki.apache.org/solr/SpatialSearch#bbox_-_Bounding-box_filter

> is *in* the {} (as
>
{it's} unique Solr only stuff http://wiki.apache.org/solr/LocalParams

> in fq={!bbox}),

yet for the "q" parameter the "name of the function" is
> outside the {} (as in q={!func}geodist()) ?
>
it's func QParser
http://lucene.apache.org/solr/api/org/apache/solr/search/FunctionQParserPlugin.html

geodist() is a
function org.apache.solr.search.function.distance.HaversineConstFunction

bbox here is a org.apache.solr.search.SpatialBoxQParserPlugin

>
> Or the parameters to the bbox search function are specified as separate
> query parameters? (the sfield and pt parameters) ?
>
"query parser" instead "search function"
> Would be happy to understand the logic behind it.
>
>
> Thank you,
> Maxim.
>
> On Wed, Jan 18, 2012 at 9:11 PM, Mikhail Khludnev <
> [EMAIL PROTECTED]> wrote:
>
> > Can you try to specify two fqs, geodist as a function query, sort by
> score?
> >
> >
> >
> fq={!bbox}&.....&sort=score%20asc&fq=trafficRouteId:235&q={!func}geodist()&fl=*,score
> >
> > On Wed, Jan 18, 2012 at 4:46 PM, Maxim Veksler <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hello Mikhail,
> > >
> > > Please see reply inline.
> > >
> > > On Wed, Jan 18, 2012 at 11:00 AM, Mikhail Khludnev <
> > > [EMAIL PROTECTED]> wrote:
> > >
> > > > Maxim,
> > > >
> > > > Which version of Solr you are using?
> > > >
> > >
> > > As mentioned in the title, I'm using Solr 3.5.
> > >
> >
> > I see
> >
> >
> > >
> > >
> > > > Why the second approach at the link doesn't work for you?
> > > >
> > > I'm not sure I'm following. I'm trying to use bbox instead of
> > >
> > > I use the fq fields to define the bbox filtering.
> > > I also need to query by another parameter (trafficRouteId).
> > >
> > you can put trafficRouteId as a second fq, as I did above
> >
> >
> > >
> > > I would optimally would be happy to get the distance calculation from
> > Solr
> > > but that doesn't seem to work in any format of query I tried.
> > >
> > pls try my approach above and let me know what you get.
> >
> >
> >
> > >
> > > Being new to Solr query language I'm not sure how to form the search
> > terms
> > > to combine all of this with the score.
> > >
> > >
> > >
> > > > what do you get on this case? pls provide, logs, exception, and debug
> > > > response.
> > > >
> > > > Thanks
> > > >
> > > >
> > > > On Tue, Jan 17, 2012 at 10:06 PM, Maxim Veksler <[EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > I'm querying with bbox which should be faster then geodist, my
> > queries
> > > > are
> > > > > looking like this:
> > > > >
> > > > >
> > > >
> > >
> >
> http://localhost:8983/solr/select?indent=true&fq={!bbox}&sfield=loc&pt=39.738548,-73.130322&d=100&sort=geodist()%20asc&q=trafficRouteId:235
> > > > <
> > > >
> > >
> >
> http://localhost:8983/solr/select?indent=true&fq=%7B%21bbox%7D&sfield=loc&pt=39.738548,-73.130322&d=100&sort=geodist%28%29%20asc&q=trafficRouteId:235
> > > > >
> > > > >
> > > > > the trouble is, that with bbox solr does not return the distance of
> > > each
> > > > > document, I couldn't get it to work even with tips from
> > > > > http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance
> > > > >
> > > > > Something I'm missing ?

Sincerely yours
Mikhail Khludnev
Lucid Certified
Apache Lucene/Solr Developer
Grid Dynamics

<http://www.griddynamics.com>
 <[EMAIL PROTECTED]>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB