Created
October 9, 2012 16:01
-
-
Save imsickofmaps/3859733 to your computer and use it in GitHub Desktop.
riak mapreduce problems
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
query = riakclient.add('products') | |
query.map(""" | |
function(v, arg) { | |
var data = JSON.parse(v.values[0].data); | |
if(data.category == arg.category) { | |
return [[v.key, arg.category]]; | |
} else { | |
return []; | |
} | |
}""", {"category":"food"}) | |
for result in query.run(): | |
print result |
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
[u'772216be03d211e2b7ae080027feaaaf', None] | |
[u'e90186a803d111e2b7ae080027feaaaf', None] | |
[u'ac8ddb0003d011e2b7ae080027feaaaf', None] | |
[u'132d425603d111e2b7ae080027feaaaf', None] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment