lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Kaleske <Oliver.Kale...@ptvgroup.com>
Subject RE: Migrate BooleanQuery Lucene 4.9.0 to Lucene 6.0.3
Date Thu, 10 Nov 2016 11:37:19 GMT
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:humrocha@gmail.com] 
Sent: Thursday, November 10, 2016 2:32 AM
To: java-user@lucene.apache.org
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
Mime
View raw message