couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: View to show top tags
Date Sun, 08 Nov 2009 20:31:20 GMT
On Sun, Nov 8, 2009 at 3:57 AM, Smrchy <smrchy@gmail.com> wrote:
> The example you mention does not work at all (throws an internal JSON error)
> while this example:
>
> http://wiki.futuretoby.com/Retrieve_The_Top_N_Tags_in_CouchDB
>
> does run but the results are not anywere near right. If i modify the map
> function to only use a subset of the docs in my DB the values seem to get
> closer to the real count.

There's actually a bug in that snippet I've been meaning to fix. If
you look at the code its keeping the left edge as it rereduces so that
it can allow the recursed reduce to figure out if it needs to be
dropped or not. After I more thoroughly groked how reductions work I
realized that the same logic needs to be applied to both edges as the
reductions proceed.

Also, you need to sort the key/value arrays using the Spidermonkey
collations because of some nasty side effects of UCA vs Spidermonkey
string sorting.

HTH,
Paul Davis

Mime
View raw message