Matt,

Add {'keep':true} to your final reduce phase.

On Wed, Jun 13, 2012 at 12:04 AM, Matt Black <matt.bl...@jbadigital.com>wrote:

> Hello list,
>
> In an M/R query, I'd like to be able to merge objects from two different
> buckets in my output. So my process is a map phase for each bucket, with a
> link phase in the middle, and a reduce phase to do a bit of merge
> processing at the end.
>
> client = riak.RiakClient(RIAK_HOST, RIAK_PORT)
> query = client.add("carts")
> query.map("function(v) { return [[ v.bucket, v.key,
> Riak.mapValuesJson(v)[0] ]]; }", {'keep': False})
> query.link("cart-products", "cart-products", False)
> query.link("products", "product", False)
> query.map("function(v) { return [ Riak.mapValuesJson(v)[0] ]; }", {'keep':
> False})
> query.reduce("function(values) { return values; }")
>
> This query will return only objects from the "products" bucket.
>
> I tried using the "keep" flags on each map phase, but in this case the I
> get output from each map phase and the reduce phase appears to be ignored -
> which is somewhat unexpected.
>
> Please advise on changes or things I could try.
>
> Thanks
>
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>


-- 
Sean Cribbs <s...@basho.com>
Software Engineer
Basho Technologies, Inc.
http://basho.com/
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to