Solr/Lucene user click based ranking

牧云@^-^@ 提交于 2019-12-11 12:23:46

问题


I am facing the problem of sort Lucene results based on user click log. I would like that more accessed results comes first. Does anyone knows how to configure or implement such property in Lucene or Solr?

Thank you very much.


回答1:


You can declare a sortable integer field (let's call it clickNum) in your schema, setting it to zero by default for each indexed document. When a user opens a document your app triggers an update of clickNum field by setting clickNum = clickNum + 1.

At query-side you can set a muptiple sorting based on your primary sort parameter (if any) and clickNum: sort=<field name>+<direction>[,clickNum+desc]

You can avoid document update by storing your click log in an external database and reordering your results with post-query elaboration, but IMHO that's not a good option.




回答2:


Using Dismax could be a good option. The bf (Boost Functions) parameter of Dismax could be set to boost the documents with a high click count.

If you don't want to use Dismax, you can also use a function query in the bf (Boost Functions) parameter.



来源:https://stackoverflow.com/questions/2944158/solr-lucene-user-click-based-ranking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!