在Lucene的BooleanClause.Occur.Must和BooleanClause.Occur.SHOULD的区别 [英] Difference between BooleanClause.Occur.Must and BooleanClause.Occur.SHOULD in lucene

查看:643
本文介绍了在Lucene的BooleanClause.Occur.Must和BooleanClause.Occur.SHOULD的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以用一个例子解释BooleanClause.Occur.Must和BooleanClause.Occur.SHOULD之间的差异的Lucene BooleanQuery?

Can anyone explain the difference between the BooleanClause.Occur.Must and BooleanClause.Occur.SHOULD in lucene in BooleanQuery with an example?

推荐答案

BooleanClause.Occur.SHOULD 表示子句是可选的,而 BooleanClause .Occur.Must 意味着该条款是强制性的。

BooleanClause.Occur.SHOULD means that the clause is optional, whereas BooleanClause.Occur.Must means that the clause is compulsory.

但是,如果一个布尔查询只有可选的条款,至少有一个子句必须出现在结果的文件相匹配。

However, if a boolean query only has optional clauses, at least one clause must match for a document to appear in the results.

有关在什么文件匹配BooleanQuery更好的控制,也有<一个href=\"http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/api/core/org/apache/lucene/search/BooleanQuery.html#setMinimumNumberShouldMatch%28int%29\">minimumShouldMatch参数,它可以让你告诉Lucene的,至少 minimumShouldMatch BooleanClause.Occur.SHOULD 条款必须出现在文档匹配结果

For better control over what documents match a BooleanQuery, there is also a minimumShouldMatch parameter which lets you tell Lucene that at least minimumShouldMatch BooleanClause.Occur.SHOULD clauses must match for a document to appear in the results.

这篇关于在Lucene的BooleanClause.Occur.Must和BooleanClause.Occur.SHOULD的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆