Solr Facet Filter - q 与 fq 返回不同的结果?

发布于 2024-12-10 08:16:16 字数 213 浏览 5 评论 0原文

谁能告诉我为什么这些 Solr 查询会返回截然不同的结果:

q=BBC+Food&fq=Source:"BBC-WORLDWIDE"

q=(BBC+Food)+AND+(Source:"BBC-WORLDWIDE")

一个返回 6 个结果,后者返回 58 个结果。

Can anybody tell me why these Solr queries would return vastly different results:

q=BBC+Food&fq=Source:"BBC-WORLDWIDE"

and

q=(BBC+Food)+AND+(Source:"BBC-WORLDWIDE")

The first returns 6 results, and the latter 58.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

殊姿 2024-12-17 08:16:16

您能否将 &debugQuery=on 添加到查询末尾,并查看调试输出中的值是否有助于了解两个查询之间的差异?

Can you add &debugQuery=on to the end of your queries and see if the values in the debug output lend any insight into the different between the two queries?

独孤求败 2024-12-17 08:16:16

事实证明,第一个查询正在搜索同时包含 BBC AND Food 一词的文档。第二个查询使用 OR 逻辑搜索任一单词。

通过将关键字放在括号中,并将其与任何其他子句组合,Solr 似乎反转了关键字隐含的“AND”逻辑,而是应用“OR”逻辑。

以下查询更好地证明了这一点:

q=(BBC+食物)

q=(BBC+食物)+AND+(BBC+食物)

它们都返回非常不同的结果,因为关键字应用了相反的逻辑。

It turns out that the first query is searching for documents that contain both the words BBC AND Food. The second query is searching for either of the words using OR logic.

By placing the keywords in parenthesis, and combining it with any other clause, Solr appears to be inverting the implied "AND" logic for the keywords and instead applying "OR" logic.

The following queries demonstrate this a little better:

q=(BBC+Food)

q=(BBC+Food)+AND+(BBC+Food)

They both return very much different results because the keywords have reversed logic applied.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文