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)

Reply via email to