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 ashokc <as...@qualcomm.com> on 2008/12/04 22:30:26 UTC

Boost a query by field at query time - Standard Request Handler

Here is the problem I am trying to solve. I have to use the Standard Request
Handler.

Query (can be quite complex, as it gets built from an advanced search form):
term1^2.0 OR term2 OR "term3 term4"

I have 3 fields - content (the default search field), title and url.

Any matches in the title or url fields should be weighed more. I can specify
index time boosting for these two fields, but I would rather not, as it is a
heavy handed solution. I need to make it user configurable for advanced
search.

What should my query to SOLR be? Something like this?

content:term1^2.0 OR content:term2 OR content:"term3 term4" OR
title:term1^2.0 OR title:term2 OR title:"term3 term4" OR url:term1^2.0 OR
url:term2 OR url:"term3 term4"

Looks like it can get pretty long and error prone. With the 'dismax' handler
I can simply specify

qf=content title^2 url^2

no matter how complex the 'q' parameter is.

Is there a similar easier way I can do query time boosting with Standard
Request Handler, that I am missing?

Thanks for your help

- ashok

-- 
View this message in context: http://www.nabble.com/Boost-a-query--by-field-at-query-time---Standard-Request-Handler-tp20842675p20842675.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Boost a query by field at query time - Standard Request Handler

Posted by ashokc <as...@qualcomm.com>.
Thanks for the reply. I figured there is no simple solution here. I am
parsing the query in my code separating out negations, assertions and such
and building the final SOLR query to issue. I simply ue the boost as given
by the user. If none given, I use a default boost for title & url matches.

- ashok



hossman wrote:
> 
> 
> : Query (can be quite complex, as it gets built from an advanced search
> form):
> : term1^2.0 OR term2 OR "term3 term4"
> 	...
> : Any matches in the title or url fields should be weighed more. I can
> specify
> 
> if i'm understanding you correctly: the client app can provide any 
> arbitrary lucene syntax query, and you want to (server side) specify 
> additional information about how specific fields (if specified) should be 
> boosted ... is that correct?
> 
> there is no way to do this with standard request handler out of the box 
> ... but you could subclass the LuceneQParser, and use your own QueryParser 
> subclass that knows about your field boosts and adds them -- don't forget 
> you'll have to decide what to do when the client specifies a boost on a 
> field you've got a configured boost for (add them? ... multiply them? ...)
> 
> 
> 
> 
> -Hoss
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Boost-a-query--by-field-at-query-time---Standard-Request-Handler-tp20842675p20920307.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Boost a query by field at query time - Standard Request Handler

Posted by Chris Hostetter <ho...@fucit.org>.
: Query (can be quite complex, as it gets built from an advanced search form):
: term1^2.0 OR term2 OR "term3 term4"
	...
: Any matches in the title or url fields should be weighed more. I can specify

if i'm understanding you correctly: the client app can provide any 
arbitrary lucene syntax query, and you want to (server side) specify 
additional information about how specific fields (if specified) should be 
boosted ... is that correct?

there is no way to do this with standard request handler out of the box 
... but you could subclass the LuceneQParser, and use your own QueryParser 
subclass that knows about your field boosts and adds them -- don't forget 
you'll have to decide what to do when the client specifies a boost on a 
field you've got a configured boost for (add them? ... multiply them? ...)




-Hoss