From user-return-6750-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue Oct 06 18:07:58 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 1780 invoked from network); 6 Oct 2009 18:07:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Oct 2009 18:07:58 -0000 Received: (qmail 12707 invoked by uid 500); 6 Oct 2009 18:07:48 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 12674 invoked by uid 500); 6 Oct 2009 18:07:47 -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 12658 invoked by uid 99); 6 Oct 2009 18:07:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2009 18:07:47 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of seggy.umboh@gmail.com designates 209.85.210.203 as permitted sender) Received: from [209.85.210.203] (HELO mail-yx0-f203.google.com) (209.85.210.203) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2009 18:07:38 +0000 Received: by yxe41 with SMTP id 41so9635849yxe.30 for ; Tue, 06 Oct 2009 11:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=+0snkmZZXvxwCBxiOR8ZyseabsuVwNTCfrQiHjkDiFc=; b=C89+XDhvJwQRs76vAynbq7GaYlybPj0ru/hfI7WgasdavfjfzlRZGIhckLf0AN121g 8JRTSw/XLKBIMhXEYuTU0QJslfIllJBCFbQHSM4kqeh5fr4AQko6wwN05wWSxy73i7Lq MrElDlnTM/1b/5mbmJdwNXJyUs8D4rq4JT1rI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=t0KgW9fEglcdA8RjVH0vWO7VJ81kBdwuF0TCZHXgVxEaUIyQ2ZNpg+8qxYnBjT5GuA w5Ecrzui4TtTVRQ82FH8WOg7AT7lUnNksiqbCfEJtWLz3/KFzQTND8bqnbWPlxuSTMRB 4qQ4CV3SMNJvCFNnJ2tASWPET8k2gmNRWIvkA= MIME-Version: 1.0 Received: by 10.91.19.4 with SMTP id w4mr870395agi.0.1254852437368; Tue, 06 Oct 2009 11:07:17 -0700 (PDT) Date: Tue, 6 Oct 2009 11:07:16 -0700 Message-ID: Subject: Re: Getting a top 10 list by a calculated value From: Seggy Umboh To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=001485f54790c65f13047548197d X-Virus-Checked: Checked by ClamAV on apache.org --001485f54790c65f13047548197d Content-Type: text/plain; charset=UTF-8 Thanks for the replies! Awesome solutions, obviously I haven't been reading the wiki in quite enough detail and am still kinda stuck in the SQL mindset, wanting to sort the resultset somehow. Looks like the view snippet Paul pointed out would solve the exact question I posed in a MR way, but require you to know the N ahead of time to do the top-N query (or at least the maximum possible N), whereas the doc update hook Zach suggested would solve the case where we really need the sorted resultset, but incurs an update-time cost (like a SQL index I guess) > Apologies for not thinking the first time. > > There's an example on the wiki [1] called "Retrieve the top N tags" > that does that you want. It only works because you know what N is a > priori though. > > HTH, > Paul Davis > > [1] http://wiki.apache.org/couchdb/View_Snippets > > On Mon, Oct 5, 2009 at 9:36 PM, Seggy Umboh wrote: > > Hello everyone, > > I've been reading about couchdb and just started playing around with it, and > > I am wondering, in the typical blog/comment example application, is it > > possible to get a list of the Top 10 commenters? It is trivial to write a > > view to get the number of comments for each commenter, but now I want to > > sort the result of that view by the values.... > > --001485f54790c65f13047548197d--