I want to penalize some terms in query, not to ignore them at all so "MUST NOT" operator will not work? Is it possible to use negative query boost with SHOULD in boolean query in lucene, how does it work?
Asked
Active
Viewed 2,430 times
1 Answers
7
Yes, a query term boost is simply a multiplication factor, so setting it to a negative value will have the affect you want.
Here's a thread from the lucene mailing list discussing negative boost.
In summary in is like a NOT but less strict, in that matching documents will still appear in search results i.e.
Any positive score (>0) will have the affect of increasing the default score.
Any negative score (<0) will have the affect of decreasing the default score.

Joel
- 29,538
- 35
- 110
- 138
-
but "apple^-0.0001 juice^0.85" aren't supported by Lucene, isn't it? – samsamara Jan 21 '16 at 07:38
-
do you know how can I set a negative boost in lucene? – samsamara Jan 21 '16 at 07:39