Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 98523 invoked from network); 21 Jan 2011 17:59:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jan 2011 17:59:49 -0000 Received: (qmail 90089 invoked by uid 500); 21 Jan 2011 17:59:48 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 89804 invoked by uid 500); 21 Jan 2011 17:59:45 -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 89793 invoked by uid 99); 21 Jan 2011 17:59:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 17:59:45 +0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=SPF_HELO_PASS,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of david@cloudant.com does not designate 216.86.168.183 as permitted sender) Received: from [216.86.168.183] (HELO mxout-08.mxes.net) (216.86.168.183) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 17:59:36 +0000 Received: from [192.168.1.100] (unknown [67.180.255.146]) by smtp.mxes.net (Postfix) with ESMTPA id CB168509F1 for ; Fri, 21 Jan 2011 12:59:14 -0500 (EST) Message-ID: <4D39C971.6020809@cloudant.com> Date: Fri, 21 Jan 2011 09:59:13 -0800 From: David Hardtke User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: Doubts with multiple keys! References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Fabio, I'm assuming the your "value" is the document that you want to retrieve. There is no need to include the document in the view result directly. Your value can be null. When you retrieve the view you can add include_docs=true to the query and it will append the document to your results. Dave On 01/21/11 09:39, Fabio Batalha Cunha dos Santos wrote: > Now that I know that this is the only way to access same content using > different fields "keys", I have one more question. > > For example: > > I have other view (VIEW A) that bring a lot of info, this view have 3 keys, > "Subject", "collection", "title" this view could return something around > 300.000 registers "depends on the query". If I want to priorize the search > for collection instead of subject I must create a new view (VIEW B) changing > the order of the key, that is it? probably yes! > > (VIEW A) > > {"id":"e5b72d48-5d18-43a8-aef9-27bd46f93fba","key":["Agricultural > Sciences","scl","Scientia > Agricola"],"value":{"collection":"scl","issn":"0103-9016","title":"Scientia > Agricola","subject":["AGRONOMIA"],"publisher":{"_":"S\u00e3o Paulo - > Escola Superior de Agricultura \"Luiz de > Queiroz\""},"insert_date":"19981016"}}, > {"id":"317c2636-7e56-422e-9720-f351568acc7f","key":["Agricultural > Sciences","scl","Summa > Phytopathologica"],"value":{"collection":"scl","issn":"0100-5405","title":"Summa > Phytopathologica","subject":["AGRONOMIA; FITOPATOLOGIA; > FITOSSANIDADE"],"publisher":{"_":"Grupo Paulista de > Fitopatologia"},"insert_date":"20061011"}}, > {"id":"ea6d6684-a638-4ea6-8035-982ed8dd7326","key":["Agricultural > Sciences","scl","Tropical Plant > Pathology"],"value":{"collection":"scl","issn":"1982-5676","title":"Tropical > Plant Pathology","subject":["FITOPATOLOGIA"],"publisher":{"_":"Sociedade > Brasileira de Fitopatologia"},"insert_date":"20080422"}}, > {"id":"baadd506-9a83-4645-9dba-3c766a7a51b8","key":["Agricultural > Sciences","ven","Agroalimentaria"],"value":{"collection":"ven","issn":"1316-0354","title":"Agroalimentaria","subject":["CIENCIAS > ECON\u00d3MICAS Y SOCIALES, SOCIOLOG\u00cdA, AGRICULTURA, > NUTRICI\u00d3N, ECONOM\u00cdA AGROALIMENTARIA, CONSUSMO DE ALIMENTOS, > SEGURIDAD ALIMENTARIA, SISTEMA ALIMENTARIO, > ALIMENTACI\u00d3N"],"publisher":{"_":"Centro de Investiagciones > Agroalimentarias (CIAAL), Facultad de Ciencias Econ\u00f3micas y > Sociales, Universidad de los Andes"},"insert_date":"20030407"}}, > {"id":"02c01a5c-8986-4533-b390-f8a874ba2e8d","key":["Agricultural > Sciences","ven","Bioagro"],"value":{"collection":"ven","issn":"1316-3361","title":"Bioagro","subject":["AGRONOM\u00cdA, > BOT\u00c1NICA, ZOOLOG\u00cdA"],"publisher":{"_":"Decanato de > Agronom\u00eda de la Universidad Centroccidental \"Lisandro Alvarado\" > (UCLA)"},"insert_date":"20050310"}}, > {"id":"edcf204d-b219-43ba-b565-d6c55f940e40","key":["Agricultural > Sciences","ven","Revista de la Facultad de > Agronom\u00eda"],"value":{"collection":"ven","issn":"0378-7818","title":"Revista > de la Facultad de Agronom\u00eda","subject":["AGRICULTURA Y > GANADER\u00cdA TROPICAL"],"publisher":{"_":"Facultad de > Agronom\u00eda. Universidad del Zulia "},"insert_date":"20030715"}}, > {"id":"b9963ad8-7454-4085-a980-375ccacb9fef","key":["Agricultural > Sciences","ven","Zootecnia > Tropical"],"value":{"collection":"ven","issn":"0798-7269","title":"Zootecnia > Tropical","subject":["GANADER\u00cdA"],"publisher":{"_":"Instituto > Nacional de Investigaciones Agricolas INIA, Maracay, Venezuela. > "},"insert_date":"20041115"}}, > {"id":"c2c64c77-712e-4e4b-a24d-0c9e81790512","key":["Agropecuarias > Sciences","cub","Cultivos > Tropicales"],"value":{"collection":"cub","issn":"0258-5936","title":"Cultivos > Tropicales","subject":["INVESTIGACIONES > AGR\u00cdCOLAS"],"publisher":{"_":"Ediciones > INCA"},"insert_date":"20090424"}}, > {"id":"e20d515c-e912-42c1-979f-1b1058cc499e","key":["Applied Social > Sciences","chl","ARQ > (Santiago)"],"value":{"collection":"chl","issn":"0717-6996","title":"ARQ > (Santiago)","subject":["ARQUITECTURA"],"publisher":{"_":"Ediciones > ARQ"},"insert_date":"20011212"}}, > {"id":"50930791-6632-4fe4-a750-53b6fb64709e","key":["Applied Social > Sciences","chl","Bolet\u00edn del Museo Chileno de Arte > Precolombino"],"value":{"collection":"chl","issn":"0718-6894","title":"Bolet\u00edn > del Museo Chileno de Arte > Precolombino","subject":["ANTROPOLOGIA"],"publisher":{"_":"Museo > Chileno de Arte Precolombino"},"insert_date":"20081105"}}, > {"id":"6ec2ffbd-6539-4b66-bbd1-cffae01829c7","key":["Applied Social > Sciences","chl","Chungar\u00e1 > (Arica)"],"value":{"collection":"chl","issn":"0717-7356","title":"Chungar\u00e1 > (Arica)","subject":["ARQUEOLOGIA"],"publisher":{"_":"Universidad de > Tarapac\u00e1
Facultad de Ciencias Sociales Administrativas y > Econ\u00f3micas
"},"insert_date":"20020415"}}, > > > (VIEW B) > > {"id":"e5b72d48-5d18-43a8-aef9-27bd46f93fba","key":["scl","Agricultural > Sciences","Scientia > Agricola"],"value":{"collection":"scl","issn":"0103-9016","title":"Scientia > Agricola","subject":["AGRONOMIA"],"publisher":{"_":"S\u00e3o Paulo - > Escola Superior de Agricultura \"Luiz de > Queiroz\""},"insert_date":"19981016"}}, > {"id":"317c2636-7e56-422e-9720-f351568acc7f","key":["scl","Agricultural > Sciences","scl","Summa > Phytopathologica"],"value":{"collection":"scl","issn":"0100-5405","title":"Summa > Phytopathologica","subject":["AGRONOMIA; FITOPATOLOGIA; > FITOSSANIDADE"],"publisher":{"_":"Grupo Paulista de > Fitopatologia"},"insert_date":"20061011"}}, > {"id":"ea6d6684-a638-4ea6-8035-982ed8dd7326","key":["scl","Agricultural > Sciences","scl","Tropical Plant > Pathology"],"value":{"collection":"scl","issn":"1982-5676","title":"Tropical > Plant Pathology","subject":["FITOPATOLOGIA"],"publisher":{"_":"Sociedade > Brasileira de Fitopatologia"},"insert_date":"20080422"}}, > {"id":"baadd506-9a83-4645-9dba-3c766a7a51b8","key":["ven","Agricultural > Sciences","Agroalimentaria"],"value":{"collection":"ven","issn":"1316-0354","title":"Agroalimentaria","subject":["CIENCIAS > ECON\u00d3MICAS Y SOCIALES, SOCIOLOG\u00cdA, AGRICULTURA, > NUTRICI\u00d3N, ECONOM\u00cdA AGROALIMENTARIA, CONSUSMO DE ALIMENTOS, > SEGURIDAD ALIMENTARIA, SISTEMA ALIMENTARIO, > ALIMENTACI\u00d3N"],"publisher":{"_":"Centro de Investiagciones > Agroalimentarias (CIAAL), Facultad de Ciencias Econ\u00f3micas y > Sociales, Universidad de los Andes"},"insert_date":"20030407"}}, > {"id":"02c01a5c-8986-4533-b390-f8a874ba2e8d","key":["ven","Agricultural > Sciences","Bioagro"],"value":{"collection":"ven","issn":"1316-3361","title":"Bioagro","subject":["AGRONOM\u00cdA, > BOT\u00c1NICA, ZOOLOG\u00cdA"],"publisher":{"_":"Decanato de > Agronom\u00eda de la Universidad Centroccidental \"Lisandro Alvarado\" > (UCLA)"},"insert_date":"20050310"}}, > {"id":"edcf204d-b219-43ba-b565-d6c55f940e40","key":["ven","Agricultural > Sciences","Revista de la Facultad de > Agronom\u00eda"],"value":{"collection":"ven","issn":"0378-7818","title":"Revista > de la Facultad de Agronom\u00eda","subject":["AGRICULTURA Y > GANADER\u00cdA TROPICAL"],"publisher":{"_":"Facultad de > Agronom\u00eda. Universidad del Zulia "},"insert_date":"20030715"}}, > {"id":"b9963ad8-7454-4085-a980-375ccacb9fef","key":["ven","Agricultural > Sciences","Zootecnia > Tropical"],"value":{"collection":"ven","issn":"0798-7269","title":"Zootecnia > Tropical","subject":["GANADER\u00cdA"],"publisher":{"_":"Instituto > Nacional de Investigaciones Agricolas INIA, Maracay, Venezuela. > "},"insert_date":"20041115"}}, > {"id":"c2c64c77-712e-4e4b-a24d-0c9e81790512","key":["cub","Agropecuarias > Sciences","Cultivos > Tropicales"],"value":{"collection":"cub","issn":"0258-5936","title":"Cultivos > Tropicales","subject":["INVESTIGACIONES > AGR\u00cdCOLAS"],"publisher":{"_":"Ediciones > INCA"},"insert_date":"20090424"}}, > {"id":"e20d515c-e912-42c1-979f-1b1058cc499e","key":["chl","Applied > Social Sciences","ARQ > (Santiago)"],"value":{"collection":"chl","issn":"0717-6996","title":"ARQ > (Santiago)","subject":["ARQUITECTURA"],"publisher":{"_":"Ediciones > ARQ"},"insert_date":"20011212"}}, > {"id":"50930791-6632-4fe4-a750-53b6fb64709e","key":["chl","Applied > Social Sciences","Bolet\u00edn del Museo Chileno de Arte > Precolombino"],"value":{"collection":"chl","issn":"0718-6894","title":"Bolet\u00edn > del Museo Chileno de Arte > Precolombino","subject":["ANTROPOLOGIA"],"publisher":{"_":"Museo > Chileno de Arte Precolombino"},"insert_date":"20081105"}}, > {"id":"6ec2ffbd-6539-4b66-bbd1-cffae01829c7","key":["chl","Applied > Social Sciences","Chungar\u00e1 > (Arica)"],"value":{"collection":"chl","issn":"0717-7356","title":"Chungar\u00e1 > (Arica)","subject":["ARQUEOLOGIA"],"publisher":{"_":"Universidad de > Tarapac\u00e1
Facultad de Ciencias Sociales Administrativas y > Econ\u00f3micas
"},"insert_date":"20020415"}}, > > > *The questions:* > > The index files became to large when creating view that represents a huge > among of data. > Is it the way the things work in couchdb? We could/must have a lot of views > that bring mostly the same data just changing the key parameters to perform > different queries? > > Thanks a lot! > *Fabio Batalha C. Santos* > Colegiado SciELO > www.scielo.org > FAPESP - CNPq - BIREME - FapUNIFESP > > > > On Fri, Jan 21, 2011 at 3:19 PM, Paul Daviswrote: > >> On Fri, Jan 21, 2011 at 12:12 PM, Fabio Batalha Cunha dos Santos >> wrote: >>> Hello All, >>> >>> I'm doing a lot of tests with views with multiple keys. I'd like to know >> if >>> is it possible to ignore the content of the first key when fetching a >> view. >>> For example: >>> >>> I have this view: >>> >>> {"rows":[ >>> {"key":["arg","h"],"value":10721}, >>> {"key":["arg","i"],"value":855}, >>> {"key":["arg","t"],"value":71}, >>> {"key":["chl","h"],"value":28129}, >>> {"key":["chl","i"],"value":2158}, >>> {"key":["chl","t"],"value":92}, >>> {"key":["col","h"],"value":13696}, >>> {"key":["col","i"],"value":1156}, >>> {"key":["col","t"],"value":96}, >>> ]} >>> >>> I'd like to with the startkey + endkey parameter filter the result to: >>> >>> {"rows":[ >>> {"key":["arg","i"],"value":855}, >>> {"key":["chl","i"],"value":2158}, >>> {"key":["col","i"],"value":1156}, >>> ]} >>> >>> Is it possible? >>> >> Nope. If you want to do that you'll need to create a second view with >> a reordered key, or a key that doesn't include what you want to skip. >> >>> Thanks in advance, >>> >>> *Fabio Batalha C. Santos* >>> Colegiado SciELO >>> www.scielo.org >>> FAPESP - CNPq - BIREME - FapUNIFESP >>>