RE: Unexpected Results - using should and must in boolean query

2010-09-17 Thread Uwe Schindler
e.apache.org > Subject: RE: Unexpected Results - using should and must in boolean query > > > : If you have some MUST terms, but you also want to have at least one of a > : list of other terms (like 5 SHOULD clauses), the trick is to separate both: > : Create a BooleanQuery wi

RE: Unexpected Results - using should and must in boolean query

2010-09-17 Thread Chris Hostetter
: If you have some MUST terms, but you also want to have at least one of a : list of other terms (like 5 SHOULD clauses), the trick is to separate both: : Create a BooleanQuery with 2 MUST clauses, one is your required TermQuery : and the second clause is itself a BooleanQuery with all the SHOULD

Re: Unexpected Results - using should and must in boolean query

2010-09-12 Thread liat oren
Hi, Thanks for both of you for the answer. I will try the solution of Uwe, it looks like your suggestion will solve my problem. Many thanks, Liat On 12 September 2010 16:51, Uwe Schindler wrote: > Hi, > > I always recommend my customers to not mix should and must in the same > BooleanQuery

RE: Unexpected Results - using should and must in boolean query

2010-09-12 Thread Uwe Schindler
Hi, I always recommend my customers to not mix should and must in the same BooleanQuery if strict boolean matching is needed. It will match all docs, containing the MUST clause and "boost" all SHOULD terms. If you have some MUST terms, but you also want to have at least one of a list of other ter

Re: Unexpected Results - using should and must in boolean query

2010-09-12 Thread Erick Erickson
This is expected. The clause you add with MUST does just that, any documents returned MUST have that term. The SHOULD part of the query just says will simply bump the scores of documents with that clause. As to scores being different on the queries (and I'm having a hard time understanding your po