couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hhsuper <hhsu...@gmail.com>
Subject Re: 'Grouping' documents so that a set of documents is passed to the view function
Date Wed, 24 Jun 2009 10:35:56 GMT
Hi, Brian

>From your description give me some thought about my previous view, which
impl in reduce function depend on group query to process documents, which
will encounter some problem:

map function emit structure(key cols refer to uid/dialogid/sessionid):
*emit( ["86", "10380", "4172"], *{wordCount: 20, weightedScore: 1380, grade:
69})

reduce function return: {wordCount: 20, weightedScore: 1380, grade: 69}

the reduce function's logic: first caculate the sum value for every unique
uid_dialogid_sessionid key, then get the max value for every unique
uid_dialogid key, at last sum the values for the key uid, these
caculate onwordCount/
weightedScore/grade

but for the couchdb's increcemental update view, when the new document added
with uid/dialogid/sessionid value same with previous caculated document, the
new document's value will be caculated in reduce function but without
exactly comply the reduce logic because there is no previous value to
execute some compare

i need to modify the reduce to complex and with return large object which i
don't wanted, any suggestion?

On Tue, Jun 23, 2009 at 3:59 PM, Brian Candler <B.Candler@pobox.com> wrote:

> On Tue, Jun 23, 2009 at 09:15:46AM +0800, hhsuper wrote:
> >    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?
>
> If sufficient information is passed through from reduce to re-reduce, yes.
> But it may mean your 'reduce' function has to output a large object and
> your
> re-reduce function is complex.
>



-- 
Yours sincerely

Jack Su

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