incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Kutcharian <d...@venarc.com>
Subject Re: Data Modeling: Comments with Voting
Date Sat, 29 Sep 2012 19:25:31 GMT
Thanks Roshni,

I'm not sue how #d will work when users are actually voting on a comment. What happens when
two users vote on the same comment simultaneously? How do you update the entries in #d column
family to prevent duplicates?

 Also #a and #c can be combined together using TimeUUID as comment ids.

- Drew



On Sep 27, 2012, at 2:13 AM, Roshni Rajagopal <roshni_rajagopal@hotmail.com> wrote:

> 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 etc
> b) when a person votes for a comment, increment a vote counter : have a counter column
family for incrementing the votes for each comment
> c) 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