Set score vs. Boost score

Hi,

I want to create a script that boosts the scores of documents by a
computed amount. I want to boost the score, not replace it.

The code I tried looks like this (qb is a QueryBuilder built by
earlier code):

qb = new CustomScoreQueryBuilder(qb)
.lang("mvel")
.script("2");

The expected result is that this would multiply all the scores of the
results by 2. (I realize there are better ways to multiply by 2, but I
intend to replace the 2 with a more complex formula once I know it
works).

What happens, instead, is that all the scores for all the hits are set
equal to 2.

If I could access the original score and multiply it myself, I would
do so, but I tried using doc.score to access it and this didn't work
at all.

How can I accomplish the desired result?

Thanks.

Please don't send the same question twice.

The script should be "_score * 2".

On Wednesday, January 25, 2012 at 11:27 PM, Frank LaRosa wrote:

Hi,

I want to create a script that boosts the scores of documents by a
computed amount. I want to boost the score, not replace it.

The code I tried looks like this (qb is a QueryBuilder built by
earlier code):

qb = new CustomScoreQueryBuilder(qb)
.lang("mvel")
.script("2");

The expected result is that this would multiply all the scores of the
results by 2. (I realize there are better ways to multiply by 2, but I
intend to replace the 2 with a more complex formula once I know it
works).

What happens, instead, is that all the scores for all the hits are set
equal to 2.

If I could access the original score and multiply it myself, I would
do so, but I tried using doc.score to access it and this didn't work
at all.

How can I accomplish the desired result?

Thanks.