donmqryh49993 2011-03-22 14:27
浏览 16
已采纳

从数据库中获取流行词(“趋势”词组)

I have a MySQL database and I'm trying to get trending topics (popular phrases or words) using PHP. I've tried a few queries but nothing seems to be working for me.

  • 写回答

1条回答 默认 最新

  • dongxiequ3724 2011-03-22 14:33
    关注

    You could try creating a new table with two columns: WORD and COUNT, then run some queries to split the text entries on whitespace, and insert or update the new table by either inserting a new word, or bumping the count, if it's already there. Then, you could create a trigger or scheduled job to keep the new table up to date.

    The benefit of this approach, is that you'd only need to scan through the source tables once to build the word list. You could throttle the scan by limiting it to a X rows per run, and then running it on a timer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?