incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject chaining map reduce in hovercraft
Date Fri, 05 Jun 2009 05:47:21 GMT
I finally got around to writing my map reduce copier. it's still
basic, but what do you think?

I want to put it into trunk as an http call, like:

POST /_snapshot_view

with JSON

{"src":"/srcdb/_design/app/_view/reduce_count", "group_level":2,
"target":"/targetdb"}

Chainable map reduce seems to be one of the most popular requests on
the survey we took, so hopefully this will make the heavy-data crew
happy.

There is an implementation here:

http://github.com/jchris/hovercraft/commit/34b44527b660a740858cc71aa2c8326747465e31#L0R290

What this does is take the results you'd get from query your reduce
view with group=true, and copy them to a new database. Basically you
end up with a database full of docs that look like:

{
"key":[2009,2,14],
"value": 511
}

Since they are docs sitting in another CouchDB, you can use more
ordinary CouchDB Map Reduce views on that database to do things like
sort by value, so you can for instance sort tags by popularity, or
days by user activity, etc.

Chris


-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message