incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: Question about multiple query parameters
Date Tue, 24 Apr 2012 16:09:21 GMT
Views are one-dimensional, sorted on the whole key.

For 1) you will need a view like;

  emit([doc.TYPE, doc.AUTHOR, doc.DATE], doc);

and queried with ?startkey=["type I want", "bob"]&endkey=["type I
want", "bob", {}]

for 2)

   emit([doc.TYPE, doc.DATE, doc.AUTHOR], doc);

and queried with ?startkey=["type I want", "start date"]&endkey=["type
I want", "end date", {}]

I also advise emitting null instead of doc and using
include_docs=true. This saves space as everything emitted as key or
value is copied into the view file (expect attachments).

B.

On 24 April 2012 17:04, Tim Daly <timothyddaly@yahoo.com> wrote:
> I have a view that emits values like this:
> emit([doc.TYPE, doc.DATE, doc.AUTHOR], doc);
>
> I want to be able to execute the following queries:
> 1) Get all of a certain type, within a date range, with the author "bob" (sorted by date)
> 2) Get all of a certain type, within a date range, with any author (sorted by date)
>
> I believe the date must come before the author to keep the date sorting first, correct?
> I am having trouble getting this to work?  Can you search on two ranges?  I believe
the answer is "not directly".  How do I achieve this?  I guess you can't even search for
"bob" after the range either because its the third parameter.  Also if it makes any difference
I am doing everything through Ektorp.
>
> Thanks for any help!!!

Mime
View raw message