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 William Bell <bi...@gmail.com> on 2013/05/25 23:31:52 UTC

exact match country

OK here is the use case:

- Someone types "Dr. Joe Smith"
- We have the lat long of the user (say Denver, CO)
- We want to limit to 50 km around Denver, but if there is an exact match
we want to put that one at the top of the results.
- If there an elegant way to do this? Or do we need to run 2 queries?

/select?q=*:*&fq={!dismax}"Dr. Joe Smith" OR {!geofilt}&d=50&pt=(lat long
for Denver)&sort=geodist() desc

But I want the Dr. Joe Smith to show at the top. I could boost it by like
100.

/select?q=*:*&fq={!dismax}"Dr. Joe Smith"^100 OR {!geofilt}&d=50&pt=(lat
long for Denver)&bq=geodist()&sort=score desc

Thoughts?



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

Re: exact match country

Posted by William Bell <bi...@gmail.com>.
Thanks David.... !


On Sun, May 26, 2013 at 8:02 AM, David Smiley (@MITRE.org) <
DSMILEY@mitre.org> wrote:

> Hi Bill.
>
> So it seems you want an exact match to be first even if it is outside the
> spatial region, right?  Your suggested implementation suggests this.  And
> apparently you want to sort by distance, notwithstanding the exact match
> being first.  Although you don't have to do this as two queries, I think
> separating out the exact match search from the spatial filter is a good
> approach.  I suspect you might want to show this exact match hit (if there
> is one) similar to how google will display an ad at the top of the search
> results.  That is, it will appear differently, and it won't "count" towards
> the total hits and paging.  If that seems like what you want to do, then
> there you have it.  I think based on your requirements that you've stated
> that this approach makes the most sense.
>
> If you really want this exact-match result to be just another matched
> document that won't seem special to the user, then your 2nd query below is
> close.  You should use 'q', not 'fq'; filter queries don't score.
>
> ~ David
>
>
> Billnbell wrote
> > OK here is the use case:
> >
> > - Someone types "Dr. Joe Smith"
> > - We have the lat long of the user (say Denver, CO)
> > - We want to limit to 50 km around Denver, but if there is an exact match
> > we want to put that one at the top of the results.
> > - If there an elegant way to do this? Or do we need to run 2 queries?
> >
> > /select?q=*:*&fq={!dismax}"Dr. Joe Smith" OR {!geofilt}&d=50&pt=(lat long
> > for Denver)&sort=geodist() desc
> >
> > But I want the Dr. Joe Smith to show at the top. I could boost it by like
> > 100.
> >
> > /select?q=*:*&fq={!dismax}"Dr. Joe Smith"^100 OR {!geofilt}&d=50&pt=(lat
> > long for Denver)&bq=geodist()&sort=score desc
> >
> > Thoughts?
> >
> >
> >
> > --
> > Bill Bell
>
> > billnbell@
>
> > cell 720-256-8076
>
>
>
>
>
> -----
>  Author:
> http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/exact-match-country-tp4066093p4066132.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



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

Re: exact match country

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Hi Bill.

So it seems you want an exact match to be first even if it is outside the
spatial region, right?  Your suggested implementation suggests this.  And
apparently you want to sort by distance, notwithstanding the exact match
being first.  Although you don't have to do this as two queries, I think
separating out the exact match search from the spatial filter is a good
approach.  I suspect you might want to show this exact match hit (if there
is one) similar to how google will display an ad at the top of the search
results.  That is, it will appear differently, and it won't "count" towards
the total hits and paging.  If that seems like what you want to do, then
there you have it.  I think based on your requirements that you've stated
that this approach makes the most sense.

If you really want this exact-match result to be just another matched
document that won't seem special to the user, then your 2nd query below is
close.  You should use 'q', not 'fq'; filter queries don't score.

~ David


Billnbell wrote
> OK here is the use case:
> 
> - Someone types "Dr. Joe Smith"
> - We have the lat long of the user (say Denver, CO)
> - We want to limit to 50 km around Denver, but if there is an exact match
> we want to put that one at the top of the results.
> - If there an elegant way to do this? Or do we need to run 2 queries?
> 
> /select?q=*:*&fq={!dismax}"Dr. Joe Smith" OR {!geofilt}&d=50&pt=(lat long
> for Denver)&sort=geodist() desc
> 
> But I want the Dr. Joe Smith to show at the top. I could boost it by like
> 100.
> 
> /select?q=*:*&fq={!dismax}"Dr. Joe Smith"^100 OR {!geofilt}&d=50&pt=(lat
> long for Denver)&bq=geodist()&sort=score desc
> 
> Thoughts?
> 
> 
> 
> -- 
> Bill Bell

> billnbell@

> cell 720-256-8076





-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/exact-match-country-tp4066093p4066132.html
Sent from the Solr - User mailing list archive at Nabble.com.