couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seggy Umboh <seggy.um...@gmail.com>
Subject Re: Getting a top 10 list by a calculated value
Date Tue, 06 Oct 2009 18:07:16 GMT
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 <seggy.umboh@gmail.com> 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....
> >

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message