如何在Lucene 6.x中实例化一个BooleanQuery?
如何使用布尔查询在其中添加其他查询?
在Lucene 4.x中,我们使用BooleanQuery如下:
BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(query1, BooleanClause.Occur.MUST); booleanQuery.add(query2, BooleanClause.Occur.MUST);
如何在Lucene 6中实现这一目标.
和链接的JIRA问题的更改).
相反,您现在将使用BooleanQuery.Builder:
BooleanQuery booleanQuery = new BooleanQuery.Builder() .add(query1, BooleanClause.Occur.MUST) .add(query2, BooleanClause.Occur.MUST) .build();
翻译自:https://stackoverflow.com/questions/37904977/lucene-6-0-how-to-instantiate-a-booleanquery-and-add-other-search-queries-in-it