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 Martynas Miliauskas <mm...@gmail.com> on 2010/07/31 13:22:50 UTC

Boosting DisMax queries with !boost component

Hi guys,

I have following boosting query:
b=scale(popularity,0,1)

So far I have tried following queries, and got following results:

   1.
   http://localhost:8080/solr/select?q={!boost%20$b=scale(popularity,0,1)%20v=$qq%20defType=dismax}&qf=title+tags&fl=*,score&qq=s<http://localhost:8080/solr/select?q={!boost%20$b=scale(popularity,0,1)%20v=$qq%20defType=dismax}&qf=title+tags&fl=*,score&qq=struggle>olr,
   This returns results which scores are not modified by boosting query, I
   checked that using debug mode.
   2.
   http://localhost:8080/solr/select?q=product(scale(popularity,0,1),%20query($qq))&qq={!dismax%20qf=title+tags}<http://localhost:8080/solr/select?q=product(scale(popularity,0,1),%20query($qq))&qq={!dismax%20qf=title+tags}suka>solr.
   No results at all.
   3.
   http://localhost:8080/solr/select?q=product(scale(popularity,0,1),%20query({!dismax%20qf='title%20tags'%20v='suka'})).
   This gave me an error "Cannot parse
   'product(scale(popularity,0,1),query({!dismax qf='title tags' v='solr'}))':
   Encountered " <RANGEEX_GOOP>"tags\'"" at line 1, column 56. Was expecting:
   "}" ..." Even though queries 2 and 3 are pretty much equivalent to the ones
   shown here http://wiki.apache.org/solr/FunctionQuery#query.

The Solr version that I am using is 1.4.0. So, has anyone ever tried to use
boosting queries with DisMax query parser and maybe could give a working
examples for my case? Or maybe I am doing something wrong here?

Thanks!

RE: Boosting DisMax queries with !boost component

Posted by MitchK <mi...@web.de>.

Jonathan Rochkind wrote:
> 
>> qf needs to have spaces in it, unfortunately the local query parser can
>> not
>> deal with that, as Erik Hatcher mentioned some months ago.
> 
> By "local query parser", you mean what I call the LocalParams stuff (for
> lack of being sure of the proper term)?  
> 
Yes, that was what I meant.

Kind regards,
- Mitch
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Boosting-DisMax-queries-with-boost-component-tp1011294p1015619.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Boosting DisMax queries with !boost component

Posted by Jonathan Rochkind <ro...@jhu.edu>.
> qf needs to have spaces in it, unfortunately the local query parser can not
> deal with that, as Erik Hatcher mentioned some months ago.

By "local query parser", you mean what I call the LocalParams stuff (for lack of being sure of the proper term)?  You can put spaces in there, you just need to put it in quotes (single or double). I've been doing it with no problems.  I forget if backslash-escaping is also possible there, it may be, but that would get extra confusing if you have a nested query AND local params, which is my case. But using single quotes for one and double for the other works fine:

Your q equals the URI encoded form of:  _query_: "{!dismax qf='something^10 other^100'}some query"

Ie:

 &q=_query_%3A%22%7B%21dismax+qf%3D%27something%5E10+other%5E100%27%7Dsome+query%22%29

Can get confusing to make sure you've got all the escaping right, especially when you're constructing the query in software that itself needs to have quotes escaped, but it works fine if you get it all right. Mitch's suggestion may indeed be less confusing if there's no reason in your context not to use it (there was in mine). 

> {!dismax%20qf=$yourqf}yourQuery&yourgf=title^1.0 tags^2.0

Jonathan

Re: Boosting DisMax queries with !boost component

Posted by MitchK <mi...@web.de>.
Hi,

qf needs to have spaces in it, unfortunately the local query parser can not
deal with that, as Erik Hatcher mentioned some months ago.

A solution would be to do something like that:

{!dismax%20qf=$yourqf}yourQuery&yourgf=title^1.0 tags^2.0

Since you are using the dismax-query-parser, you can add the boosting query
via bq-param.

Hope this helps,
- Mitch
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Boosting-DisMax-queries-with-boost-component-tp1011294p1014242.html
Sent from the Solr - User mailing list archive at Nabble.com.