Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 94238 invoked from network); 8 Nov 2009 20:32:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Nov 2009 20:32:04 -0000 Received: (qmail 26715 invoked by uid 500); 8 Nov 2009 20:32:03 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 26641 invoked by uid 500); 8 Nov 2009 20:32:03 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 26631 invoked by uid 99); 8 Nov 2009 20:32:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Nov 2009 20:32:03 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.211.186 as permitted sender) Received: from [209.85.211.186] (HELO mail-yw0-f186.google.com) (209.85.211.186) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Nov 2009 20:32:00 +0000 Received: by ywh16 with SMTP id 16so2370189ywh.13 for ; Sun, 08 Nov 2009 12:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=yWgh/tKWRuIJheLYVr5ie6UH1a+Y/ihaKwsS0Xs7CAM=; b=eHX4X05Y+KU4AMAqQgfKOkHXTJcC46XLUQ3y0W/l5uFN5ew1sIWFK1C48NL4qiJL0B yrgDTYAWe1v+23DzN1O2LQpoZv6yCdJoJ7+iTgCm3nrYVCZt8nyc5U3l6TC7c6QFaPgm uwHOQ71VTFqMheKzrgXVjcQomU8Igf49KSMmQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=SYAgETDpTnBHJrXcwHNzaa3IY19pDmiEUml/qMLfvYDfEK+gVgD90sjcq6cf47YHNt pU1s0RT5tzFUAcABrmdUUwWI1RLCqpfJQC8wlQej6Tq9h1eP3OHBpLA5aR6WWdJssjHh iRSanj7+PIVSaPL5VQf8bZUdpoHmeHQch9NmE= MIME-Version: 1.0 Received: by 10.101.49.17 with SMTP id b17mr5795618ank.11.1257712300080; Sun, 08 Nov 2009 12:31:40 -0800 (PST) In-Reply-To: References: From: Paul Davis Date: Sun, 8 Nov 2009 15:31:20 -0500 Message-ID: Subject: Re: View to show top tags To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 On Sun, Nov 8, 2009 at 3:57 AM, Smrchy 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