Cassandra sorting results by count

前端 未结 2 1279
半阙折子戏
半阙折子戏 2021-01-19 05:27

I am recording data on users searching for various keywords. What I\'d like to produce is a report of all of the unique keywords that the users have searched for, sorted in

2条回答
  •  情话喂你
    2021-01-19 06:13

    You could use each keyword as a row key, and use a counter column for each row to track the number of searches. You could then produce a report by scanning over every row and reading the counters. Cassandra won't sort the results (assuming you use the default RandomPartitioner rather than an OrderPreservingPartitioner), but given that there will presumably only be a few tens of thousands of keywords, you can easily sort them at the client.

提交回复
热议问题