Boosting DisMax queries with !boost component

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Boosting DisMax queries with !boost component

mmiliaus
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!
Reply | Threaded
Open this post in threaded view
|

Re: Boosting DisMax queries with !boost component

MitchK
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
Reply | Threaded
Open this post in threaded view
|

RE: Boosting DisMax queries with !boost component

Jonathan Rochkind
> 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
Reply | Threaded
Open this post in threaded view
|

RE: Boosting DisMax queries with !boost component

MitchK
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