Created
February 19, 2010 09:35
-
-
Save lstoll/308585 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save some test entries | |
$ curl -X PUT -H 'content-type: text/plain' \ | |
http://localhost:8098/raw/LinkTest/item1 --data-binary "First item" | |
$ curl -X PUT -H 'content-type: text/plain' \ | |
-H 'Link: </raw/LinkTest/item1>; riaktag="parent"' \ | |
http://localhost:8098/raw/LinkTest/item2 --data-binary "Second item" | |
$ curl -X PUT -H 'content-type: text/plain' \ | |
-H 'Link: </raw/LinkTest/item2>; riaktag="parent"' \ | |
http://localhost:8098/raw/LinkTest/item3 --data-binary "Third item" | |
# walk using URL paths | |
$ curl http://localhost:8098/raw/LinkTest/item3/LinkTest,parent,1 | |
--2nRmTLMRwem7l2q3h4hUI76OcUC | |
Content-Type: multipart/mixed; boundary=4cr7n4Uy4MDpmrLbfpksBCpFzbq | |
--4cr7n4Uy4MDpmrLbfpksBCpFzbq | |
X-Riak-Vclock: a85hYGBgzGDKBVIs7DafH2YwJTLmsTL8v/DpCF8WAA== | |
Location: /raw/LinkTest/item2 | |
Content-Type: text/plain | |
Link: </raw/LinkTest>; rel="up", </raw/LinkTest/item1>; riaktag="parent" | |
Etag: 62GQjqTmzuotYEYelVfjcg | |
Last-Modified: Fri, 19 Feb 2010 09:08:15 GMT | |
Second item | |
--4cr7n4Uy4MDpmrLbfpksBCpFzbq-- | |
--2nRmTLMRwem7l2q3h4hUI76OcUC-- | |
$ curl http://localhost:8098/raw/LinkTest/item3/LinkTest,parent,0/LinkTest,parent,1 | |
--aPstOhCC7ChGvyVzgBt5BOU5WGj | |
Content-Type: multipart/mixed; boundary=2EAkkRfeCLiSwXEiUC9aODyOymr | |
--2EAkkRfeCLiSwXEiUC9aODyOymr | |
X-Riak-Vclock: a85hYGBgzGDKBVIsjCt3eWcwJTLmsTK8Pf/pCF8WAA== | |
Location: /raw/LinkTest/item1 | |
Content-Type: text/plain | |
Link: </raw/LinkTest>; rel="up" | |
Etag: 1J5uvU7dFfmP0adQ7SYjD8 | |
Last-Modified: Fri, 19 Feb 2010 09:03:41 GMT | |
First item | |
--2EAkkRfeCLiSwXEiUC9aODyOymr-- | |
--aPstOhCC7ChGvyVzgBt5BOU5WGj-- | |
# HOWEVER - when I try to access this over the /mapred API as both a Link phase only, | |
# I just get a 500. | |
$ curl -X POST http://localhost:8098/mapred --data-binary \ | |
'{"inputs":[["LinkTest", "item3"]], | |
"query":[ {"link": {"bucket":"LinkTest","tag":"parent","keep":true}} ]}' | |
<html><head><title>500 Internal Server Error</title></head><body><h1>Internal Server Error</h1>The server encountered an error while processing this request:<br><pre>{error,{exit,{json_encode,{bad_term,{{<<"LinkTest">>,<<"item2">>}, | |
<<"parent">>}}}, | |
[{mochijson2,json_encode,2}, | |
{mochijson2,'-json_encode_array/2-fun-0-',3}, | |
{lists,foldl,3}, | |
{mochijson2,json_encode_array,2}, | |
{mapred_resource,process_post,2}, | |
{webmachine_resource,resource_call,3}, | |
{webmachine_resource,do,3}, | |
{webmachine_decision_core,resource_call,1}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine web server</ADDRESS></body></html> | |
# However with a map function it works as expected | |
$ curl -X POST http://localhost:8098/mapred --data-binary \ | |
'{"inputs":[["LinkTest", "item3"]], | |
"query":[ {"link": {"bucket":"LinkTest","tag":"parent","keep":false}}, | |
{"map": {"language": "javascript", | |
"source": "function(v) {return [v.values[0].data]; }","keep":true}} ]}' | |
-> ["Second item"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment