couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Kuprianov <andrey.koupria...@gmail.com>
Subject Re: Multiple key value query
Date Fri, 30 Nov 2012 01:33:08 GMT
HI Bill,

That would be very difficult to do in one shot. You are basically looking
for a way to use multiple startkey-endkey pairs, which is not yet available
in CouchDB.

Easiest way would be to install Lucene or ElasticSearch on top of CouchDB (
http://wiki.apache.org/couchdb/Full_text_search). That will widen your
querying capabilities big time. Another easy, but very straightforward way
would be to do query 3 times for each location and then combine results
programmatically.

  Andrey




On Fri, Nov 30, 2012 at 1:56 AM, Bill <bill.foshay@noteandgo.com> wrote:

> Hi,
>
> I'm newer to couchdb and having some trouble figuring out how to do a query
> with multiple key values, including a date range. I have a map function
> like
> the following
>
> function(doc) {
>   if(doc.type == "Article") {
>     emit([doc.location, doc.release_date], doc)
>   }
> }
>
> I'm wondering if it's possible to do a query similar to either of the
> following
> sql queries
>
> select * from myView
> where location in ('MD', 'NY', 'VA') and
> release_date > '2012-11-01' and release_date < '2012-12-01'
>
> OR
>
> select * from myView
> where (location='MD' or location='NY' or location='VA') and
> (release_date > '2012-11-01' and release_date < '2012-12-01')
>
> Thanks for any help you can provide!
>
> Bill
>
>

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