Hi Alexander, Very nice answer, interesting! Can you explain how to do this with Riak Search? I had to admit I never used it in the past (Riak 0.14 and Riak 1.x), and once installed Riak 2.0 and tried to enable it my Riak cluster was not starting (I guess I missed something in the configuration).
Cheers, Alex On Mon, Jun 30, 2014 at 10:28 AM, Christian Dahlqvist <christ...@basho.com> wrote: > Hi Alex, > > In Riak 2.0 you can create a map data type that can contain a number of > related counters. If you have a limited number of named counters, e.g. for > scorers in the World Cup, this would allow you to update multiple counters > using a single operation and read all of then as a single key retrieval. > > If you however have a large number of counters that can not fit into a > single value, this approach will not work. Instead of trying to retrieve > the top values through MapReduce, you could instead enable Riak Search 2.0 > for the bucket and query the largest values through Solr, which should be > more efficient and flexible than using MapReduce. > > Best regards, > > Christian > > > On Mon, Jun 30, 2014 at 7:17 AM, Alex De la rosa <alex.rosa....@gmail.com> > wrote: > >> A "set" may not be a good solution if you have many counters getting >> updated at once and you should do the sorting (if possible) before saving >> the "set" back into RIAK. >> >> The goal scoring was a very simple/small example... but imagine you want >> to do Twitter's Trending Topics counting which twits has more comments (if >> we have a "comments" counter)... will be too massive to save it all in a >> "set". >> >> I guess that MapReduce will be the way in this case. >> >> Cheers, >> Alex >> >> >> On Mon, Jun 30, 2014 at 12:14 AM, Alexander Sicular <sicul...@gmail.com> >> wrote: >> >>> Not that I know of. I believe keys are independent in this regard. Basho >>> is introducing sets in riak 2.0 but I don't think they will bee sorted sets >>> like in redis. >>> >>> -Alexander >>> >>> @siculars >>> http://siculars.posthaven.com >>> >>> Sent from my iRotaryPhone >>> >>> On Jun 29, 2014, at 15:54, Alex De la rosa <alex.rosa....@gmail.com> >>> wrote: >>> >>> Hi there, >>> >>> I have a question about something that just came up to my mind... can we >>> determine which counter is higher in a bucket? For example: >>> >>> # Taking the FIFA World Cup as example: >>> >>> bucket = client.bucket_type('counter_bucket').bucket('goals') >>> counter = bucket.new('Neymar') >>> counter.increment(4) >>> counter = bucket.new('Messi') >>> counter.increment(4) >>> counter = bucket.new('JamesRodriguez') >>> counter.increment(5) >>> >>> Is there any way (without using MapReduce) to get the top scorer of the >>> World Cup? or a descendent ordered list of the keys by its value? >>> >>> Cheers, >>> Alex >>> >>> _______________________________________________ >>> riak-users mailing list >>> riak-users@lists.basho.com >>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >>> >>> >> >> _______________________________________________ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> >> >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com