Link walking and keep field

Anton Podviaznikov podviaznikov at gmail.com
Fri Oct 21 15:15:39 EDT 2011


Hi,

Thank you for your response. Ok, so I'll use URL-syntax for link walking.
Another problem here. I'm using riak-js as client library. And in this
library for link walking (method "walk") M/R style used internally:
https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L79

What should I do in such situation? Should I implemented another walk method
and send pull request to Francisco Treacy?

P.S. Could you please put this information in the official documentation (at
least I didn't find it there)? Because it's confusing since 'keep' flag
exists in both URL-syntax and M/R link phase and behavior is different. The
only difference that was mentioned  - multipart response for link walking
using URL-syntax.

Best regards,
Anton Podviaznikov

On 21 October 2011 20:37, Sean Cribbs <sean at basho.com> wrote:

> Anton,
>
> Sorry for the delay. Yes you can use MapReduce link-phases in a similar
> way, but unlike the link-walking resource, the objects pointed to in each
> phase will not be returned.  The way link-walking does its work is to split
> the URL into segments for each phase that has keep=true (1), then issue a
> MapReduce request for the traversal up to the first keep, then take the
> results of that and feed it to another that goes up to the next keep, and so
> on.  So your link-walking query is actually more like:
>
> [users/userid] -> link(projects, _, 1) -> map_value
> (results from previous) -> link(parts, _, 1) -> map_value
> (results from previous) -> link(units, _, 1) -> map_value
>
>
> On Mon, Oct 17, 2011 at 2:21 PM, Anton Podviaznikov <
> podviaznikov at gmail.com> wrote:
>
>> Hi,
>>
>> I had question about Link walking.
>> I need to walk links in few levels and keep results from previous steps.
>> I managed to achieve this using URL syntax
>> /users/userid/projects,*,1/parts,*,1/units,*,*
>> Here I find all user's projects than parts and finally units.
>>
>> However I couldn't achieve the same results using map-reduce and link
>> phases.
>>
>> curl -X POST -H "content-type: application/json"
>> http://localhost:8098/mapred --data @-<<\EOF
>> {"inputs":[["users","userid"]],"query":[{"link":{"bucket":"projects","keep":true}},{"link":{"bucket":"parts","keep":true}},{"link":{"bucket":"units"}},{"map":{"language":"javascript","source":"function(v)
>> { return [v]; }"}}]}
>> EOF
>>
>>
>> I got full documents from last step but for projects and parts I got only
>> bucket, key and tag (there was no document body and metadata).
>>
>> Is it some problem in map function? Any hints, advises?
>>
>> Best regards,
>> Anton Podviaznikov
>>
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>>
>
>
> --
> Sean Cribbs <sean at basho.com>
> Developer Advocate
> Basho Technologies, Inc.
> http://www.basho.com/
>
>


-- 
Best regards,

Anton Podviaznikov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20111021/c65f77aa/attachment.html>


More information about the riak-users mailing list