http://stackoverflow.com/questions/16359656/riak-map-reduce-in-js-returning-limited-data
I am trying to understand the re-reduce aspect with Riak. Riak reduces mapped data in stages/batches (default:20) and apparently the reduce function needs to take this into account. After much googling I have not found any examples of "js/python re-reduce in action". The input bucket has over 100 keys but after the reduce function the result has only 2 values. This has been attributed to the reduce needing to be run multiple times and "*Every iteration gets a batch of results from preceding phase together with any output from earlier reduce phase iteration(s).*" What does JS/Python code for re-reduce look like and how do I need to change the bit below. thanks Code for Map/Reduce does not work: import riak client = riak.RiakClient() query = riak.RiakMapReduce(client).add('raw_hits10') query.map("""function(v) { var data = JSON.parse(v.values[0].data); return [[data, 1]]; }""") query.reduce("""function(vk, arg) { var res = {}; for (var indx in vk) { var key_t = vk[indx][0]; var val_t = vk[indx][1]; res[key_t] = vk[indx]; } return [res] } """) for res in query.run(): print res
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com