You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Robichaud, Jean-Philippe" <Je...@scansoft.com> on 2005/03/02 22:43:02 UTC

How to set individual boost factor to each word in a phrase query ?


Hi everyone.

I've been playing with Lucene a lot in the past few months for an important
project.  We are using the raw score returned by Lucene (we created a custom
similarity) as a part of a confidence score calculation.  My problem is
exactly what the subject line of this email says: How to set individual
boost factor to each word in a phrase query?

So I would like to handle the following situation:

The user asks for "some list of words".  I know that, for some reasons that
really are uninteresting for this thread, the query should be written as:
"some^0.81 list^0.12 of^0.5 words^0.99".  Sending this string to the query
parser simply return garbage...  I could add each words manually to a
BooleanQuery and use the setBoost() member, but I really want to match the
"sentence" i.e. I don't want documents that does not respect the word order.
Also, I cannot really call explain() function because of the CPU/IO
resources that it takes and the fact that I can only look at a certain
number of element at the top of the hits object

Any thought?

Thanks, 

Jp

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How to set individual boost factor to each word in a phrase query ?

Posted by Daniel Naber <da...@t-online.de>.
On Wednesday 02 March 2005 22:43, Robichaud, Jean-Philippe wrote:

> "some^0.81 list^0.12 of^0.5 words^0.99"

You could try

"some list of words"^0 AND (some^0.81 list^0.12 of^0.5 words^0.99)

Will only match documents that contain the phrase, but score the terms (but 
also those terms in the document which are outside the phrase, maybe 
that's good enough).

Regards
 Daniel

-- 
http://www.danielnaber.de

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org