在Lucene 多条件查询我想实现 条件A and (条件B or 条件C)。请问 BooleanClause.Occur.MUST, BooleanClause.Occur.SHOULD 如何整合。或则是否有其他实现方法。谢谢。 |
|
好吧,我解决了。
BooleanQuery mainQuery = new BooleanQuery(); TermQuery contentFilter = new TermQuery(new Term(“content”, “some text”)); BooleanQuery idFilter = new BooleanQuery(); |
|
40分 |
BooleanQuery query = new BooleanQuery(); query.add(B, BooleanClause.Occur.SHOULD); query.add(C, BooleanClause.Occur.SHOULD); BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(A, BooleanClause.Occur.MUST); booleanQuery.add(query, BooleanClause.Occur.MUST); |