Depending on your needs, you could simply duplicate the comments in two
separate CFs with the column names including time in one and the vote in
the other. If you allow for updates to the comments, that would pose
some issues you'd need to solve at the app level.
On 9/26/12 4:28 PM, Drew Kutcharian wrote:
Hi Guys,
Wondering what would be the best way to model a flat (no sub comments, i.e.
twitter) comments list with support for voting (where I can sort by create time
or votes) in Cassandra?
To demonstrate:
Sorted by create time:
- comment 1 (5 votes)
- comment 2 (1 votes)
- comment 3 (no votes)
- comment 4 (10 votes)
Sorted by votes:
- comment 4 (10 votes)
- comment 1 (5 votes)
- comment 2 (1 votes)
- comment 3 (no votes)
It's the sorted-by-votes that I'm having a bit of a trouble with. I'm looking
for a roll-your-own approach and prefer not to use secondary indexes and CQL
sorting.
Thanks,
Drew