【问题标题】:Trending hot and popular topics in an application应用程序中的热门话题
【发布时间】:2017-03-11 23:22:29
【问题描述】:

我创建了一个简单的移动应用程序,后端由 Node.JS 和 MongoDB (Mongoose) 和 express 组成。 我的应用具有主题,其中包含以下字段:

_id, title, subtitle, details,...,tags[ ], viewCount, likeCount, shareCount, cmetsCount, updatedAt, createdAt

现在我想主要根据viewCount、likeCount、shareCount、cmetsCount来寻找热门话题(当前热门热门话题)(欢迎其他建议)

目前我正在使用以下公式:

popularity = viewCount * 1 + likeCount * 2 + shareCount * 2 + commentsCount * 3

但这是愚蠢的,因为它没有考虑到趋势的主要目标是当前(现在)

关于如何改进我的公式以获得预期结果的任何建议。

注意:我愿意在我的数据库中添加或修改字段

【问题讨论】:

    标签: node.js mongodb


    【解决方案1】:

    这就是我最终想到的

    popularity = 
    (viewCount * 1 + likeCount * 2 + shareCount * 2 + commentsCount * 3) / actionTimestamp
    

    其中actionTimestamp每次更新以下其中一项时都会更新viewCount、likeCount、shareCount、cmetsCount

    我知道这并不可靠,任何帮助都会得到帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-08
      • 2015-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-07
      • 1970-01-01
      相关资源
      最近更新 更多