lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szzoli <reg9sz...@freemail.hu>
Subject RE: How to build a Lucene BooleanQuery?
Date Wed, 21 Sep 2016 13:14:23 GMT
Thank you.

I solved the problem so:

BooleanQuery.Builder builder = new BooleanQuery.Builder(); 
		
TermQuery subQuery1 = new TermQuery(new Term(field, queryString1));
TermQuery subQuery2 = new TermQuery(new Term(field, queryString2));
		 
builder.add(subQuery1, BooleanClause.Occur.MUST); 
builder.add(subQuery2, BooleanClause.Occur.MUST_NOT); 
		
BooleanQuery bq = builder.build(); 



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-build-a-Lucene-BooleanQuery-tp4297102p4297150.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
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