开发者

Solr/Lucene user click based ranking

I am facing the problem of sort Lucene results based on user click log. I would like that more accessed results comes fir开发者_开发百科st. Does anyone knows how to configure or implement such property in Lucene or Solr?

Thank you very much.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜