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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With