目前我有这样的样本数据:
<doc>
<int name="name">Nice Dress</int>
<arr name="keyword">
<str>best cocktail dress</str>
<str>platform complete pumps</str>
<str>platform pumps</str>
<str>slip dress</str>
</arr>
我在“关键字”字段中使用了多个值。
案例1
defType:edismax
qf:keyword
q:cocktail dress
solr将返回数据。
案例2
defType:edismax
qf:keyword
q:coctail dress pump
它仍然返回数据,如果我们从示例数据中看到,没有关键字在每个关键字的一行中包含所有这 3 个单词('coctail' 'dress' 'pump')。 如何让solr不返回这个结果?
谢谢。
最佳答案
检查两个参数
positionIncrementGap
- 对于多值字段,此参数将决定多值字段中两个字段之间的距离。如果该值为 100,则两个多值字段之间的距离将为 100 个位置。
注意 - 默认positionIncrementGap为0
检查qs
query slop dismax 参数将决定项之间的斜率匹配。
关于solr - 字符串搜索字段多个值,所有单词必须匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18509198/