Hello,
I recently tried explaining the power of map / reduce to someone,
using a simple example of adding up hours spent on a project over a
period of time.
The output of the mapping function would be:
key, value
4/28/2008, 1
4/28/2008, 4
4/29/2008, 7
4/29/2008, 3
...
The output of the reduce function would be:
key, value
4/28/2008, 5
4/29/2008, 10
...
etc.
Shouldn't I then be able to issue a query for an arbitrary summation
of some sequential portion of the output of reduce? For example, a
sum of all of the hours between two dates / keys? It's the same
reduction function except applied across multiple keys, it could be
annotated in the b-tree index the same way the reduction per key is
done now (or will be done).
/db/_view/sum_hours/count?start_combine=4/28/2008&end_combine=4/29/2009
If it isn't safe to use the reduce function as the combine function,
it could be explicit:
"views": {
"all": "function (doc) {...snip...}",
"count": {
"map": "function (doc){...snip...}"
"reduce": "function (tag, counts){...snip...}"
"combine": "function (counts){...snip...}"
}
}
}
It seems very powerful to me, if this functionality were available.
Thanks,
-Jason