lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject RE: Unexpected Results - using should and must in boolean query
Date Sat, 18 Sep 2010 02:20:42 GMT

: 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 clauses.
: This ensures that at least one of the SHOULD terms is needed together with
: the MUST term.

BooleanQuery.setMinimumNumberShouldMatch(1) has hte same effect on what is 
matched w/o requiring a nested BooleanQuery -- and because of the coord 
factor the scores from the single BooleanQuery will probably better 
represent your goal then using the nested BooleanQueries.


--  ...  October 7-8, Boston      ...  Stump The Chump!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message