From user-return-6058-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Aug 19 07:26:04 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 15957 invoked from network); 19 Aug 2009 07:26:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Aug 2009 07:26:04 -0000 Received: (qmail 43642 invoked by uid 500); 19 Aug 2009 07:26:22 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 43594 invoked by uid 500); 19 Aug 2009 07:26:22 -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 43580 invoked by uid 99); 19 Aug 2009 07:26:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2009 07:26:22 +0000 X-ASF-Spam-Status: No, hits=3.7 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of arun.thampi@gmail.com designates 209.85.218.211 as permitted sender) Received: from [209.85.218.211] (HELO mail-bw0-f211.google.com) (209.85.218.211) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2009 07:26:11 +0000 Received: by bwz7 with SMTP id 7so178904bwz.11 for ; Wed, 19 Aug 2009 00:25:51 -0700 (PDT) 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 :date:message-id:subject:from:to:content-type; bh=tyND56PPOyeaP14TS7fglqMOh9mNyTbopVp3xU7bf1A=; b=nBBkDiJEzG4JJUfug/y4bu8VF7uCOBHHL6hGB5eJUXvNHDcIj1zzIbBMiWU0Y/HBcG 33bLN26MGPjI7xfBwsBstzITSXSZ7ujmpu0SzHGPtCC7ME8c7w642BedT6IS0f/cnWED nDwirjR9oTeRsULmQ8oLj0+9nOhKnoFFMEhfo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=WwbUMUYVFb1/9o+JabxojJMlFUb3sqKB3Ie9r4UYl4sGcB2Xpo358XQv1tK/mR+/vt 2lm/eLevmK0c9YxJgns3/tvKZOpNWdTGJ0lS4s0Sy5xfrbb800G1zHdB+x9jreuLjeIC NYtCNwuAkkyWol5S7gEDbom3kJRoPb1OoCBtQ= MIME-Version: 1.0 Received: by 10.204.143.144 with SMTP id v16mr4624782bku.167.1250666750854; Wed, 19 Aug 2009 00:25:50 -0700 (PDT) In-Reply-To: <13ae4dd50908190015x28acdc33jf17d7238ccfa66eb@mail.gmail.com> References: <13ae4dd50908190015x28acdc33jf17d7238ccfa66eb@mail.gmail.com> Date: Wed, 19 Aug 2009 15:25:50 +0800 Message-ID: Subject: Re: Hitting the reduce_limit From: Arun Thampi To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0015175ce0366ac9e10471798bdd X-Virus-Checked: Checked by ClamAV on apache.org --0015175ce0366ac9e10471798bdd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks Paul! Will take a look. Cheers, Arun On Wed, Aug 19, 2009 at 3:15 PM, Paul Carey wrote: > Hi Arun > > Your question is fairly similar to the one in the latter half of this > thread > http://n2.nabble.com/reduce_limit-error-td2789734.html#a2789734 > It may be worth looking at for your answer. > > Paul > > On Tue, Aug 18, 2009 at 4:57 PM, Arun Thampi wrote: > > Hi guys - I have the following reduce function which returns a result > object > > where each value is an object (instead of an array). Basically I'm trying > to > > get the text value of a thread and the number of associated replies. > However > > when the length of the string which is stored in the text property is > large, > > I hit the reduce_limit. The same thing happens when I try to add more > > properties to the result object. The view is queried like so: > > > http://localhost:5984/icanhazthread/_design/icanhazthread/_view/threads_with_num_replies?group_level=1 > > I > > guess my question boils down to whether this is a 'good' reduce function? > I > > remember Jan mentioning in another thread that we should not be > converting > > tall lists to wide lists, but since the result of this reduce function > > contains objects instead of arrays of objects, I'm not sure whether its > the > > same as converting from tall -> wide lists. Please correct me if I've > missed > > something. (For now i've disabled reduce_limit and it seems to be working > > fine). > > > > As always, thanks for the help! > > > > Cheers, > > Arun > > > > Reduce Function: > > > > function(keys, values, rereduce) { > > var result = { num_replies: 0, text: "" }; > > > > if(rereduce) { > > for(idx = 0; idx < values.length; idx++) { > > result.num_replies += values[idx].num_replies; > > result.text = values[idx].text; > > } > > } else { > > > > for(idx = 0; idx < values.length; idx++) { > > if(values[idx].type == 'thread') { > > result.text = values[idx].text; > > } else if(values[idx].type == 'reply') { > > result.num_replies += 1; > > } > > } > > } > > > > return result; > > } > > > > -- > > It's better to be a pirate than join the Navy - Steve Jobs > > http://mclov.in > > > -- It's better to be a pirate than join the Navy - Steve Jobs http://mclov.in --0015175ce0366ac9e10471798bdd--