问题描述
这是我的情况;
我的架构中有一个名为 elmo_field
的字段.我希望 elmo_field
应该有有效载荷的值.即
I have a field at my schema named elmo_field
. I want that elmo_field
should have payloaded values. i.e.
dorothy|0.46 sesame|0.37 big bird|0.19 bird|0.22
当用户搜索关键字,即 dorothy
时,我想将 0.46 添加到通常的分数上.如果用户搜索bigbird
,则应添加0.19,如果用户搜索bird
,则应添加0.22(添加有效载荷-或将添加有效载荷*归一化系数).
When a user searches for a keyword i.e. dorothy
I want to add 0.46 to usual score. If user searches for big bird
, 0.19 should be added and if user searches for bird
, 0.22 should be added (payloads are added - or payloads * normalize coefficient will be added).
我的意思是我将在 solr 架构的其他字段中搜索我的索引.我将同时在 elmo_field
上进行另一次搜索(这是一次完全匹配搜索),如果匹配到某些内容,我将使用有效载荷增加分数.
I mean I will make a search on my index at my other fields of solr schema. And I will make another search (this one is an exact match search) at elmo_field
at same time and if matches something I will increase score with payloads.
有什么想法吗?
推荐答案
我已经实现了一个自定义的相似性包装器.对于通常的事情,我使用了 DefaultSimilarity.如果字段是有效载荷字段,则使用我实现的另一个相似性.该相似性类只是忽略有效载荷值.我还实现了一个查询解析器,它是 edismax 的自定义版本.通过这种方法,我可以将有效载荷值添加到文档分数中.
I've implemented a custom similarity wrapper. For usual things I've used DefaultSimilarity. If a field is a payloaded field another similarity that is implemented by me is used. That similarity class just ignores payload value. I've also implemented a query parser that is a customized version of edismax. With that approach I could add payload value into the document score.
这篇关于根据 Solr 中多值字段的有效负载增加得分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!