如何更新内容的普及得分如黑客新闻的算法? [英] How to update content popularity scoring such as Hacker News algorithm?

查看:164
本文介绍了如何更新内容的普及得分如黑客新闻的算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的黑客新闻的普及算法的定制版本的我的社交网站(与一些喜欢和评论的项目)。该算法完美,但我不知道如何正确地更新项目刻痕(我存储在项目模型作为元数据分数)。

I'm using a customized version of Hacker News popularity algorithm for my social site (items with a number of likes and comments). The algorithm works perfectly but I don't know how to update item scorings correctly (I'm storing the score in item model as meta data).

现在我只是更新分数对每一个新的像和在过去9天列出的项目发表评论。这实在是太慢了,资源严重,因此我在寻找一个更好的方式来保持分数是最新的。问题是,每一个项目需要一个新的成绩时,一个人改变,以保持时间衰减。什么是更好的方式来做到这一点?我使用的Django项目。

Now I'm just updating scores on every new like and comment for items listed during past 9 days. This is really slow and resource heavy so I'm looking for a better way to keep scores up to date. Problem is that every item needs a new score when one changes to keep the time decay. What would be the better way to do this? I'm using Django for the project.

推荐答案

确定。我已经尝试使用不同的应用程序做到了: 首先,你需要在github或thornomad / Django的hitcount安装任一dokterbob / Django的普及跟踪多久的链接被访问。

OK. I have done it using different apps: First, you need to install either "dokterbob/django-popularity" on github or "thornomad/django-hitcount" to track how often a link is visited.

其次,你需要计算多少票(喜欢或收藏夹)的对象接收。为了这个目的,你可以试试brosner / Django的投票权,apgwoz / Django的最爱。

Second, you need to count how many votes (likes or favorites) an object receives. For that purpose, you can try "brosner/django-voting", "apgwoz/django-favorites".

现在你必须使用这片code - Django的populars 以把它们放在一起。 我会建议寻找到<一个href="https://github.com/hyperweek/django-populars/blob/master/populars/management/commands/update_popularity.py"相对=nofollow>这code 首先要看看它是如何工作的,了解如何把共同需要的组件。

Now you have to use this piece of code --django-populars to put them all together. I would recommend looking into this code first of all to see how it works to understand how to put together the needed components.

这篇关于如何更新内容的普及得分如黑客新闻的算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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