Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 84300 invoked from network); 23 Jun 2009 01:16:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jun 2009 01:16:27 -0000 Received: (qmail 24196 invoked by uid 500); 23 Jun 2009 01:16:37 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 24106 invoked by uid 500); 23 Jun 2009 01:16:37 -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 24095 invoked by uid 99); 23 Jun 2009 01:16:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2009 01:16:37 +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 hhsuper@gmail.com designates 209.85.222.201 as permitted sender) Received: from [209.85.222.201] (HELO mail-pz0-f201.google.com) (209.85.222.201) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2009 01:16:27 +0000 Received: by pzk39 with SMTP id 39so348600pzk.13 for ; Mon, 22 Jun 2009 18:16:06 -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 :from:date:message-id:subject:to:cc:content-type; bh=ntLtpoVg+OXVoJzRRDCAPf4CdHBefmEBk2ayRBcXVEw=; b=GyTdlrhSjXnoD+dUcb5CcfOXCRtRH4pT3FaddTeXwEDG6SdibPbLfESuwHruBkriTw mHZ5uPbtrdM943Qtr4ERZZ0gBJXPAGEZzsdgTZ1jHaj7KI94dC0CYHWK+ObbC3Vn+LSc +nbwyc0y3zthJWJFQ6efihU73IXpAuxsMfSE8= 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 :cc:content-type; b=FHUHYoYj7KafvZyroL6wMZbiVnOM52s0Gsg14aDb7WDZ11f4oVdmd6aaPYS24Pi+ox wDfWEaaHXTGcrj1NlsoZXVt9P1WGQVGQA6Uj67D+v7BVaCjs1JfJ/RFxm36icd1OgOgy MFHWh69xH3pCDcTFUyg+CQw+KLE06i9x4l7Oc= MIME-Version: 1.0 Received: by 10.114.159.6 with SMTP id h6mr5942936wae.19.1245719766294; Mon, 22 Jun 2009 18:16:06 -0700 (PDT) In-Reply-To: <20090622190530.GA18055@uk.tiscali.com> References: <69a992ac0906220649w539baba5hff01b0ab8b841da2@mail.gmail.com> <20090622190530.GA18055@uk.tiscali.com> From: hhsuper Date: Tue, 23 Jun 2009 09:15:46 +0800 Message-ID: <69a992ac0906221815h1b61e0e2r9f3ef1fe247727a9@mail.gmail.com> Subject: Re: 'Grouping' documents so that a set of documents is passed to the view function To: Brian Candler Cc: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=00163646b5bc28e18b046cf9bcd5 X-Virus-Checked: Checked by ClamAV on apache.org --00163646b5bc28e18b046cf9bcd5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Brian I know your mean, even though, we can still with reduce function which need us impl rereduce correctly process with these grouped documents and get right result, is that right brian? On Tue, Jun 23, 2009 at 3:05 AM, Brian Candler wrote: > On Mon, Jun 22, 2009 at 09:49:15PM +0800, hhsuper wrote: > > Brian's decription for reduce function is clearly, but i think you can > > achieve your goal as below: > > > > function(doc){ > > emit(doc.group_key, doc) > > } > > > > function(keys,values,rereduce){ > > //... > > } > > > > with the group=true option you can impl doc process by group_key in > reduce > > function, > > as your example reduce will be invoke two times with values: > > [firstdoc,seconddoc] which groupkey=1.... [thirddoc,forthdoc] > groupkey=2, > > No, what I'm saying is it will *not necessarily* be invoked that way. If > there are only a handful of documents with the same group key then it is > quite likely to be invoked that way. However if there are dozens or > hundreds > of documents with the same group key, it could be invoked like this: > > reduce(first bunch of documents) => R1 > reduce(second bunch of documents) => R2 > rereduce(R1,R2) > -- Yours sincerely Jack Su --00163646b5bc28e18b046cf9bcd5--