From user-return-6057-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Aug 19 07:15:35 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 12690 invoked from network); 19 Aug 2009 07:15:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Aug 2009 07:15:35 -0000 Received: (qmail 32582 invoked by uid 500); 19 Aug 2009 07:15:53 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 32506 invoked by uid 500); 19 Aug 2009 07:15:53 -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 32478 invoked by uid 99); 19 Aug 2009 07:15:53 -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:15:53 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.p.carey@gmail.com designates 209.85.220.221 as permitted sender) Received: from [209.85.220.221] (HELO mail-fx0-f221.google.com) (209.85.220.221) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2009 07:15:42 +0000 Received: by fxm21 with SMTP id 21so3463684fxm.3 for ; Wed, 19 Aug 2009 00:15:22 -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 :content-transfer-encoding; bh=PQxiRPJ3MgEtUTn0hcgv8Flylmp44pT7IQPccyRXQk4=; b=mI2gT6nkcX0ql3qCtz5Ecxl/AGBcWm/kb5WHC72MVWwMYGbLdMqlGdfazaII/jchAy qj+KIyx0F78hZoEjYG7aJp0ZWULqtIk8uIJ9Ah4F4zrPnI8i3ea+c89+thu921Xqh4Cj nyelXAcrvPmpXu/v6L6U0dq6/7Im4q3oxhrug= 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:content-transfer-encoding; b=MnBKpq4zEOzE17vY5vMcrz8fggyWIpLwx8BNjVX1RmPGE1Aa3Hwasq+1VRrsx5ReM6 OvJrDN/4g7UbR9QRuYh7MVEgTpHtNYY4iok2wlTpuWSZpp6nJEQW2fVb4KFimJeC+D6I qQhkm+q5i8gDLRiVmmJV4xkDgOps90J2wPjzw= MIME-Version: 1.0 Received: by 10.86.174.2 with SMTP id w2mr3898695fge.0.1250666122094; Wed, 19 Aug 2009 00:15:22 -0700 (PDT) In-Reply-To: References: Date: Wed, 19 Aug 2009 08:15:22 +0100 Message-ID: <13ae4dd50908190015x28acdc33jf17d7238ccfa66eb@mail.gmail.com> Subject: Re: Hitting the reduce_limit From: Paul Carey To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Arun Your question is fairly similar to the one in the latter half of this threa= d 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 obj= ect > 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. Howe= ver > when the length of the string which is stored in the text property is lar= ge, > 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_w= ith_num_replies?group_level=3D1 > =A0I > 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 convertin= g > 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 t= he > same as converting from tall -> wide lists. Please correct me if I've mis= sed > 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) { > =A0var result =3D { num_replies: 0, text: "" }; > > =A0if(rereduce) { > =A0 =A0for(idx =3D 0; idx < values.length; idx++) { > =A0 =A0 =A0result.num_replies +=3D values[idx].num_replies; > =A0 =A0 =A0result.text =3D values[idx].text; > =A0 =A0} > =A0} else { > > =A0 =A0for(idx =3D 0; idx < values.length; idx++) { > =A0 =A0 =A0if(values[idx].type =3D=3D 'thread') { > =A0 =A0 =A0 =A0result.text =3D values[idx].text; > =A0 =A0 =A0} else if(values[idx].type =3D=3D 'reply') { > =A0 =A0 =A0 =A0result.num_replies +=3D 1; > =A0 =A0 =A0} > =A0 =A0} > =A0} > > =A0return result; > } > > -- > It's better to be a pirate than join the Navy - Steve Jobs > http://mclov.in >