lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Unexpected Results - using should and must in boolean query
Date Sat, 18 Sep 2010 05:55:31 GMT
Hah, I forgot that, thanks!

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Chris Hostetter [mailto:hossman_lucene@fucit.org]
> Sent: Friday, September 17, 2010 7:21 PM
> To: java-user@lucene.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 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.
> 
> 
> 
> -Hoss
> 
> --
> http://lucenerevolution.org/  ...  October 7-8, Boston
> http://bit.ly/stump-hoss      ...  Stump The Chump!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message