Lucene 过滤器和“AND”操作员
我正在构建一个电子商务搜索,并使用 Lucene.Net 作为我的搜索引擎。不过,我在过滤查询时遇到了麻烦。
这是我索引的文档之一,具有以下字段和值:
字段:“名称”,值:“Mochila MVP”
字段:“制造商”,值:“耐克配件”
现在,当我运行这些搜索时,我得到以下结果:
用户输入的查询:
莫奇拉^5 耐克^2.5
Lucene 将其翻译为:
(((名称:mochil 制造商:mochil)^5.0) ((名称:nik 制造商:nik)^2.5))
结果:
带来产品“Mochila MVP”
用户输入的查询:
mochila^5 和耐克^2.5
Lucene 将其翻译为:
(+((名称:mochil 制造商:mochil)^5.0) +((名称:nik 制造商:nik)^2.5))
结果:
没有结果
用户输入的查询:
mochila^5 +制造商:耐克
Lucene 将其翻译为:
((名称:mochil)^5.0) +制造商:耐克
结果:
没有结果
我想知道为什么第二个和第三个查询没有结果,因为它们似乎与我的产品名称和制造商相匹配......
非常感谢任何帮助。提前致谢!
I'm building an e-commerce search and I am using Lucene.Net as my search engine. I am having trouble filtering my queries, though.
This is one of the documents I have indexed, with the following fields and values:
field: "name", value: "Mochila MVP"
field: "manufacturer", value: "Nike Accessories"
Now, when I run these searches I have the folowing results:
User typed query:
mochila^5 nike^2.5
Lucene translated it to:
(((name:mochil manufacturer:mochil)^5.0) ((name:nik manufacturer:nik)^2.5))
Results:
Brings the product "Mochila MVP"
User typed query:
mochila^5 AND nike^2.5
Lucene translated it to:
(+((name:mochil manufacturer:mochil)^5.0) +((name:nik manufacturer:nik)^2.5))
Results:
No results
User typed query:
mochila^5 +manufacturer:nike
Lucene translated it to:
((name:mochil)^5.0) +manufacturer:nike
Results:
No results
What I would like to know is why the second and third queries bring no results, because they seem to match the product's name and manufacturer to me...
Any help is highly appreciated. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
造成这种[意外]结果的可能原因有很多。以下内容可能会帮助您解决此问题:
There are a lot of possible reasons why you get such [unexpected] results. Here's what might help you in resolving this issue: