incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshni Rajagopal <roshni_rajago...@hotmail.com>
Subject RE: Data Modeling: Comments with Voting
Date Thu, 27 Sep 2012 09:13:38 GMT

Hi Drew,
I think you have 4 requirements. Here are my suggestions.
a) store comments : have a static column family for comments with master data like created
date, created by , length etcb) when a person votes for a comment, increment a vote counter
: have a counter column family for incrementing the votes for each commentc) display comments
sorted by date created: have a column family with a dummy row id  'sort_by_time_list',  column
names can be date created(timeUUID), and column value can be comment id d) display comments
sorted by number of votes: have a column family with a dummy row id 'sort_by_votes_list' and
column names can be a composite of number of votes , and comment id ( as more than 1 comment
can have the same votes)

Regards,Roshni

> Date: Wed, 26 Sep 2012 17:36:13 -0700
> From: kirk@mustardgrain.com
> To: user@cassandra.apache.org
> CC: drew@venarc.com
> Subject: Re: Data Modeling: Comments with Voting
> 
> 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
> >
> 
 		 	   		  
Mime
View raw message