简体   繁体   English

Solr-查找最接近匹配的多值字段索引

[英]Solr - finding the closest match of multivalued fields index

I have a solr index that's indexing items with multiple tags (multivalued) 我有一个Solr索引,它为具有多个标签(多值)的项目编制索引

for example : 例如 :

<item>
    <name>America x</name>
    <id>1</id>
    <tags>
        <tag>Edward Norton</tag>
        <tag>Beverly D'Angelo</tag>
        <tag>Ethan Suplee</tag>
    </tags>
</item>

<item>
    <name>The score</name>
    <id>2</id>
    <tags>
        <tag>Robert De Niro</tag>
        <tag>Edward Norton</tag>
        <tag>Marlon Brando</tag>
    </tags>
</item>

I would like to perform a query that will find the closest match to searching "Rebert De Niro" AND "Edward Norton" AND "Ben Stiller" 我想执行一个查询,该查询将找到与搜索“ Rebert De Niro”和“ Edward Norton”和“ Ben Stiller”最接近的匹配项

The complexity is, that there isn't an item that includes all the 3 tags mentioned, but the closest is the second item that has 2 out of 3 tags. 复杂性在于,没有一个项目包含所有提到的3个标签,但是最接近的是第二个项目,其中3个标签中有2个。

I wouldn't want to perform a manual permutation combined query since it can get complex if I search for many tags all at once. 我不想执行手动排列组合查询,因为如果我一次搜索很多标签,它将变得很复杂。

See the mm parameter (minimum match) available in (e)dismax. 参见(e)dismax中可用的mm参数(最小匹配)。 This allows you to say the number of clauses that should match, or the minimum number of matches necessary. 这使您可以说出应匹配的子句数,或必需的最小匹配数。 As long as you specify AND, you'll require that all clauses are present. 只要您指定AND,就将要求所有子句都存在。

You can also specify OR - documents matching more terms should be scored higher automagically iirc. 您也可以指定OR-匹配更多术语的文档应自动得分较高。 See debugQuery to see how the scoring for each match has been calculated. 请参阅debugQuery查看如何计算每个匹配项的得分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM