Skip to content

Mapreduce aliases#28

Merged
roidrage merged 2 commits into
basho:masterfrom
ericmoritz:mapreduce-aliases
May 25, 2011
Merged

Mapreduce aliases#28
roidrage merged 2 commits into
basho:masterfrom
ericmoritz:mapreduce-aliases

Conversation

@ericmoritz
Copy link
Copy Markdown
Contributor

I made aliases for all the mapred_builtins.js functions to allow for a more declarative style of querying:

result = client.add("bucket").map_values_json().reduce_sort().reduce_limit(10)

I found this to be really handy with search:

result = client.search("bucket", "title:Obama").map_values_json().reduce_sort("""function(x, y) {
// sort by reverse cron
if(x.pub_date == y.pub_date) return 0;
return x.pub_date > y.pub_date ? -1 : 1
}""").limit(10)

Eric Moritz added 2 commits May 3, 2011 20:14
This allows for a more declaritive syntax that will make functional programmers
smile:

results = client.add("bucket").map_values_json().reduce_sort().reduce_limit(10)
@roidrage roidrage merged commit c899ba0 into basho:master May 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants