incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Batalha Cunha dos Santos <fabio.bata...@scielo.org>
Subject Re: Doubts with multiple keys!
Date Fri, 21 Jan 2011 17:39:33 GMT
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<br>Facultad de Ciencias Sociales Administrativas y
Econ\u00f3micas<br>"},"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<br>Facultad de Ciencias Sociales Administrativas y
Econ\u00f3micas<br>"},"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 Davis <paul.joseph.davis@gmail.com>wrote:

> On Fri, Jan 21, 2011 at 12:12 PM, Fabio Batalha Cunha dos Santos
> <fabio.batalha@scielo.org> 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
> >
>

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