On Sun, Nov 9, 2008 at 1:36 PM, Sho Fukamachi <[EMAIL PROTECTED]> wrote:
> map: function(doc) {
> if (doc.type == 'my_doc') emit(doc.field, [doc, 1]);
> }
> reduce: function(keys, values) { return sum(values[1]) }
Anthony's second email has a working idea, but this is how I like to
do it. Will work for any map function, so you can drop the funny array
value from your map.
Reduce:
function(keys, values, rereduce) {
if (rereduce) {
return sum(values);
} else {
return values.length;
}
}
--
Chris Anderson
http://jchris.mfdz.com