From user-return-5999-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Sat Aug 15 08:22:38 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 96133 invoked from network); 15 Aug 2009 08:22:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Aug 2009 08:22:38 -0000 Received: (qmail 95594 invoked by uid 500); 15 Aug 2009 08:22:44 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 95532 invoked by uid 500); 15 Aug 2009 08:22:43 -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 Delivered-To: moderator for user@couchdb.apache.org Received: (qmail 76769 invoked by uid 99); 15 Aug 2009 07:52:58 -0000 X-ASF-Spam-Status: No, hits=3.3 required=10.0 tests=MIME_QP_LONG_LINE,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Date: Sat, 15 Aug 2009 09:52:26 +0200 Message-Id: <1214618581@web.de> MIME-Version: 1.0 From: Thomas Bock To: user@couchdb.apache.org Subject: Re: I'm going mad with reduce Organization: http://freemail.web.de/ X-Provags-Id: V01U2FsdGVkX1+C/gwEQackbef9QofXNI2CYsLceMv4t8lXKn+UDfpaXPvmd zbOUKbXnLoNOS+Rw0MHq6eXKkL2vQb9UTLiElUmZWZkyubIShkNyptPCsUCW g== Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Thank you for answering but ... >Why don't you simply emit a row for each value in Standard=3F That will =20 >then become unique rows in the reduce. You'll have to read multiple =20 >rows to get all the values though. ... I don`t understand. Maybe I haven't described the Problem not well. The docs with doc.Standard have: { Type: KK, Sign:1111, Standard:CE3, . . . } This means that I have only one kind of Standard in a doc. I think its right that it is not possible to conserve information from doc to doc on t= he map side. Therefore I have to emit the Standard value ... =20 > >Wout. > >On Aug 14, 2009, at 3:41 PM, Thomas.Bock@ptb.de wrote: > >> Dear users, >> >> I like to provide check-box input with a view. >> The couchdb contains an key named Standard with >> 90 values "CE3", 2 values "SE2", 1 value "C1" ... >> >> Now the view should deliver each value 1 times. >> After two hours playing with reduce I give up at this point: >> >> map:function(doc) { >> if(doc.Calibration.Standard){ >> var standard =3D doc.Calibration.Standard; >> ; >> emit(standard, {"Standard": standard }); >> } >> } >> reduce:function(k, v, c){ >> >> var res =3D {}; >> var star =3D new Array(); >> var j =3D0; >> >> for(var i=3D0; i< v.length; i++) { >> >> var stdr =3D v[i].Standard; >> >> if(!(res[stdr])){ >> >> res[stdr] =3D ; >> star[j] =3D v[i].Standard; >> j +=3D1; >> >> } >> >> } >> var conStr =3D star.toString(); >> var back =3D {Standard:conStr} >> return back ; >> >> } >> >> I get something like >> {"rows":[ >> {"key":null,"value":{"Standard":"CE3,SE2,CE3,CE2,CE1"}} >> ]} >> >> >> When I use the "raw" http://server:5984/db/=5Fdesign/reduce/=5Fview/standa= rd-1 >> you see that CE3 is listed two times =3F=3F >> >> I think this is a kick self problem, >> can you kick me=3F >> >> Regards >> Thomas >> =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate f=FCr nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/