gpt4 book ai didi

solr - 根据包含命中的字段提升 Solr 结果

转载 作者:行者123 更新时间:2023-12-03 22:15:06 25 4
gpt4 key购买 nike

我在浏览网页以寻找索引和搜索框架时偶然发现了 Solr。
我们绝对需要的一个功能是根据包含命中的字段来提高结果。

一个小例子:

考虑这样的记录:

<movie>
<title>The Dark Knight</title>
<alternative_title>Batman Begins 2</alternative_title>
<year>2008</year>
<director>Christopher Nolan</director>
<plot>Batman, Gordon and Harvey Dent are forced to deal with the chaos unleashed by an anarchist mastermind known only as the Joker, as it drives each of them to their limits.</plot>
</movie>

我想结合例如 title , alternative_titleplot字段到一个搜索字段中,在查看 Solr/Lucene 文档和教程后,这并不太难。
但是我也想要那些在 title 中大受欢迎的电影得分高于 alternative_title 上的点击次数而那些轮到他们的得分应该高于 plot 中的命中率。 field 。
有什么方法可以在 XML 中指示这种评分,还是我们需要开发一些自定义评分算法?

另请注意,我给出的示例是虚构的,真实数据可能包含 100 多个字段。

最佳答案

这就是 Solr 的 DismaxQueryParser 的设计目的。见 http://wiki.apache.org/solr/DisMaxRequestHandler

有很多参数,但您需要自定义的主要参数是“qf”,它是您指定应搜索哪些字段以及每个字段的提升的方式。因此,如果您希望标题占主导地位,您可以指定如下内容:

title^10alternative_title^2导演^1剧情^1

作为 qf 参数的值。您可以通过自定义示例配置和实验来设置它。

关于solr - 根据包含命中的字段提升 Solr 结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2425553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com