Solr 搜索多值字段
我有一个如下所示的多值字段:
<arr name="some_name">
<str>a-value-1 a-value-2 ....a-value-n</str>
<str>b-value-1 b-value-2 ....b-value-m</str>
</arr>
其中 n 和 m 可以任意大(假设每个
中的值来自页面或其他内容中的段落)。
我将如何搜索以使结果仅包含所有搜索参数都包含在同一
实体中的文档(即不会生成任何误报)?
例如,如果文档 A 具有以下内容:
<arr name="some_name">
<str>london foo-1 foo-2 ...foo-k 2012 foo-k+1 foo-k+2 ...foo-k+n</str>
<str>beijing bar-1 bar-2 ....bar-j 2008 bar-j+1 bar-j+2 ....bar-j+m</str>
</arr>
在搜索单词 london AND 2008 时,结果中不会包含文档 A 的查询是什么?
如果我尝试这样的 some_name:("london AND 2008"~n)
,我不知道 n 的值是多少。
I have a multivalued field that appears like this :
<arr name="some_name">
<str>a-value-1 a-value-2 ....a-value-n</str>
<str>b-value-1 b-value-2 ....b-value-m</str>
</arr>
where n and m could be arbitrarily large(assume values in each <str>
come from a paragraph in a page or something).
How would I search so that the result contains only the documents where all search parameters are contained in the same <str>
entity(That is without generating any false positive)?
For instance if the document A has this :
<arr name="some_name">
<str>london foo-1 foo-2 ...foo-k 2012 foo-k+1 foo-k+2 ...foo-k+n</str>
<str>beijing bar-1 bar-2 ....bar-j 2008 bar-j+1 bar-j+2 ....bar-j+m</str>
</arr>
what will be the query that would not include document A in the result when searching for the words london AND 2008?
If I were to try something like this some_name:("london AND 2008"~n)
, I don't know what the value of n would be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑使用高positionIncrementGap,这将有助于分离多值标记并跨不同多值条目进行交叉匹配。
然而,即使这也不是一个万无一失的解决方案。
Consider using a high positionIncrementGap, which will help to separate the multivalued tokens and cross matching across different multivalued entries.
However, even this wont be a foolproof solution.