Hi Davy
Thanks for your answer and the solution for my problem. We are already
using an inverted view of the highscores where each column stores a
highscore as TimeUUID. I didn't know it was possible to do a get_count
on a range of columns.
I hope this will be performant enough as Apache Cassandra takes all
columns from disk to calculate the count.
Stijn
On Jan 17, 9:39 am, Davy Suvee <
i...@datablend.be> wrote:
> Hi Stijn,
>
> It probably depends a bit on how you defined your model. I would
> second-guess that you defined a ColumnFamily user, row key being the user
> id containing multiple columns, one being highscore.
> In that model, put a secondary index on the highscore column. And use
> a *IndexedSlicesQuery
> *(hector-api:
http://rantav.github.com/hector/source/content/API/core/1.0-1/me/pret...)
> where you perform *addGteExpression *on highscore (i.e. finding all the
> users who have a bigger highscore). Counting the results will give you the
> position of the user in the leaderboard. (As far as I can see, no seperate
> count method exists. Performance would depend a bit on the number of users
> in the system I guess.)
>
> Another trick would be to store an inverted view of your highscores. Create
> a ColumnFamily highscores with a single row where each column contains a
> highscore. The highscores column family would hence be a sorted collection
> of scores. Using a *RangeSlicesCounterQuery *(
http://rantav.github.com/hector/source/content/API/core/1.0-1/me/pret...),