Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 30711 invoked from network); 16 Jan 2009 11:35:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jan 2009 11:35:14 -0000 Received: (qmail 67666 invoked by uid 500); 16 Jan 2009 11:35:07 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 67617 invoked by uid 500); 16 Jan 2009 11:35:06 -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 67606 invoked by uid 99); 16 Jan 2009 11:35:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2009 03:35:05 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [62.117.115.98] (HELO ns.avicomp.com) (62.117.115.98) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2009 11:34:57 +0000 Received: from fs03.avicomp.com (fs03.avicomp.com [10.9.0.15]) by ns.avicomp.com (8.13.7/8.12.5) with ESMTP id n0GBYafP006162 for ; Fri, 16 Jan 2009 14:34:36 +0300 Received: from fs03.avicomp.com ([10.9.0.15]) by fs03.avicomp.com ([10.9.0.15]) with mapi; Fri, 16 Jan 2009 14:34:36 +0300 From: Seledkin Vyacheslav To: "user@couchdb.apache.org" Date: Fri, 16 Jan 2009 14:34:35 +0300 Subject: RE: RE: How to create view to count number of unique values from documents .... ? Thread-Topic: RE: How to create view to count number of unique values from documents .... ? Thread-Index: AQHJdwGBgMzwLDkqAkeLaSpCG1qhP49cq4Hg Message-ID: References: In-Reply-To: Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, ru-RU Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Thanks for reply, Chris but you gave me no ansver. Please read my question carefully. I don't want to find how many times any particular tag are encou= ntered across the documents, but how many unique tags are in documents. The documented example only gives me ability to request and count the numbe= r of rows in ansver on the client, it is not acceptable because of huge amo= unt of data. > The documented example is the way to do it. It's really slow to > generate the view the first time, but as you add documents it will > only need to regenerate the index for those new documents. > Chris >> On Thu, Jan 15, 2009 at 2:56 AM, Viacheslav Seledkin >> After reading all docs I think it is not trivial. The task itself: I hav= e >> documents with fields >> .............. >> doc(N) =3D { >> ... >> tag:"y", >> tag:"o", >> tag:"b", >> tag:"b", >> tag:"v", >> tag:"r", >> ............ >> } >> >> doc(N+1) =3D { >> ... >> tag:"a", >> tag:"b", >> tag:"t", >> tag:"b", >> tag:"u", >> tag:"r", >> ... >> } >> >> doc(N+2)=3D { >> ... >> tag:"t", >> tag:"m", >> tag:"i", >> tag:"b", >> tag:"l", >> tag:"z", >> ........... >> } >> ............. >> and so on... >> >> How to create a view that allows to get number of unique tags throught >> various range of some keys. >> i.e >> .. >> emit(keyN1,"y") - from document doc(N) >> emit(keyN2,"o") - from document doc(N) >> .... >> emit(key(N+2),"z") - from document doc(N+2) >> .. >> >> and view request >> http://.../_view/?startkey=3DsomeStartKey&endkey=3DsomeEndKey >> gives me something like >> >> {"rows":[{"key":null,"value":12}]}???? >> >> Of course i can use documented example with emit("y",1) and >> reduce()(return >> sum(values);) and count the number of rows returned to the client but i = >> have >> many thousands of tags and it is not effective. Any help appreciated. >> >>