根据 Solr 的多值字段的有效负载增加分数 [英] Adding Boost to Score According to Payload of Multivalued Field at Solr

查看:21
本文介绍了根据 Solr 的多值字段的有效负载增加分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况;

我的架构中有一个名为 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.如果用户搜索 big bird,则应添加 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 的多值字段的有效负载增加分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆