Hi all,
I implemented the group_numrows operation which calculates the number of
reduced group rows.
As an example, a view has four unique keys.
$ curl 'http://localhost:5984/example/_design/all/_view/all?group=true'
{"rows":[
{"key":["bar","35"],"value":3},
{"key":["foo","25"],"value":3},
{"key":["somebody","20"],"value":8},
{"key":["yasu","32"],"value":4}
]}
The operation with gorup_numrows=true returns the total number of rows.
$ curl
'http://localhost:5984/example/_design/all/_view/all?group=true&group_numrows=true'
{"group_numrows":"4"}
My view has almost 100k unique keys that the reason to implement this operation.
My implementaion is ad-hoc, but if you have huge results set and just needs the
total number and small subset of the results, it might be useful.
More details and the patch is available from my blog;
http://yasu-2.blogspot.com/2010/12/couchdb-implementation-of-select.html
regards,
--
Yasuhiro ABE <[email protected]> <[email protected]>
web: http://www.yasundial.org/
twitter: http://twitter.com/YasuhiroABE