I am not clear how does this work when I want to increase the count of
user-1.

Thanks
Erez

On Thu, Mar 25, 2010 at 12:57 AM, Peter Chang <pete...@gmail.com> wrote:

> If there's not much overhead, I recommend client side as well.
>
> Otherwise, you can only sort on column. Therefore, you could create some
> sort of inverted index based on the message count.
>
> User 1 sent 50 messages.
> User 2 sent 10 messages.
> User 3 sent 25 messages.
>
> Then store a separate index that looks like:
>   ->  50-User-1-Key
>   ->  25-User-2-Key
>   ->  10-User-2-Key
>
> You'd also have to 0-pad your count so that numbers are correctly compared
> (12 is less than 110) since you'll have to use some lexical-based sorting.
>
>
>
> On Wed, Mar 24, 2010 at 1:36 PM, Erez Efrati <ere...@gmail.com> wrote:
>
>> Hi,
>>
>> I can't figure out how to use model the following using column family and
>> the way the columns are sorted (by their name).
>>
>> Lets say I have a list of users and for each user I wish to display a list
>> of all the friends he has ordered by the number of messages they sent him so
>> far (desc from most to least).
>>
>> I can't see how this is going to work since the columns sorting is always
>> by the name of the column and not its value. I thought of having a row for
>> each user and the columns will be the friends that email him. But the column
>> name needs to be the number of messages to be sorted and the value will be
>> the friend's user ID. But then, when a friend is sending a message to
>> another user how do I increment his count of message he sent so far to that
>> user?
>>
>> How can I model this with Cassandra? Is it possible?
>>
>> Thanks in advance,
>>
>> Erez Efrati
>>
>
>

Reply via email to