Hi,
try
BooleanQuery inner = new BooleanQuery.Builder().add(ownerQueryX,
Occur.SHOULD).add(groupQueryY, Occur.SHOULD).build();
BooleanQuery constrainedQuery = new BooleanQuery.Builder().add(inner,
Occur.MUST).add(query, Occur.MUST).build();
You can also split this into several statements if you prefer (probably a good
idea if you have more than just those two sub-queries per BooleanQuery).
Best regards,
Oliver
-----Original Message-----
From: Humberto Rocha [mailto:[email protected]]
Sent: Thursday, November 10, 2016 2:32 AM
To: [email protected]
Subject: Migrate BooleanQuery Lucene 4.9.0 to Lucene 6.0.3
Hi,
In Lucene 4.9.0 i have:
QueryParser parser = new QueryParser("contents",analisador);
Query query = parser.parse(parametro);
BooleanQuery constrainedQuery = new BooleanQuery();
BooleanQuery inner = new BooleanQuery();
inner.add(ownerQueryX, Occur.SHOULD);
inner.add(groupQueryY, Occur.SHOULD);
constrainedQuery.add(inner, Occur.MUST);
constrainedQuery.add(query, Occur.MUST);
How migrate this to Lucene 6.0.3?
I saw BooleanQuery.Builder
<https://lucene.apache.org/core/6_3_0/core/org/apache/lucene/search/BooleanQuery.Builder.html>
but
i have problems to use.
Could someone help me please?
--
Humberto Rocha