On Thu, Apr 4, 2013 at 3:59 PM, Jimmy Ho <[email protected]> wrote:
> inputs: [["user", "mathew"]],
> query: [ {map:... get a list of [[bucket, friend_key]] }
>
> What is the next phase to read the bucket/key values as the new inputs?
Hi, Jimmy. If that map phase is producing a list of [bucket, key]
pairs, as you describe, the only thing you need to do to use them as
inputs is to add another map phase right after that one. So:
inputs: [["user", "mathew"]],
query: [ {map:… get a list of [[bucket, friend_key]] },
{map:… do something with a friend}
Riak will handle reading each object and passing it into the map
function for you.
The special thing you may have been thinking of is "link-walking". If
instead of storing the list of friends in the object (or in addition
to), you stored their names in the Link metadata, you could use:
inputs: [["user", "mathew"]],
query: [ {link: {bucket:"user", tag:"friend"}},
{map:… do something with a friend}
The 'link' phase would do the bucket-key-pair production for you. You
still use a map phase right afterward to work with the objects that
were linked.
Or, if you just wanted the friend/user objects, instead of some piece
of them, you could use the URL
http://host:port/buckets/user/keys/mathew/user,friend,1
http://docs.basho.com/riak/latest/references/appendices/concepts/Links/
Cheers,
Bryan
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com