Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6AC01DA27 for ; Fri, 30 Nov 2012 01:33:56 +0000 (UTC) Received: (qmail 45048 invoked by uid 500); 30 Nov 2012 01:33:54 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 45005 invoked by uid 500); 30 Nov 2012 01:33:54 -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 44994 invoked by uid 99); 30 Nov 2012 01:33:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 01:33:54 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andrey.kouprianov@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vb0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 01:33:49 +0000 Received: by mail-vb0-f52.google.com with SMTP id ez10so12339432vbb.11 for ; Thu, 29 Nov 2012 17:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=2jRiwt25SyYdMV17Q5NOy4RUBtpZg3V7+pJk/jG8Gmk=; b=tRzT0d8WZ+D3jdNOV2Ci77zM8ekzumOh40tzKUIec3yFaN1WzvycFZkLfPyC52BYWL JmLfMs8y+BbgSlxqY4K/MldkaLSzz5cNUXeRyZxRFS6ZL166FrtuyOacVZ9YzNZyqGiN fU/UYYsUHuWSjdYM6idutV3osr4MIOTfjIyoxUxacWqGf3EMvYYOR98BV3ttM/n3s6aV bY4afeRJtANoAvuKg7/QrZTGkFWXiiHl5o+ZBQOiEAH2/mVW2kLa2XUQyqlMETn0pz/T l5gJTIOOBMCFEBOD5FrFJZBnxUYthk5dVMN3kTNuJBX75sSk15+93aXCEWTgMb2AILna h6rA== Received: by 10.52.17.70 with SMTP id m6mr27299205vdd.92.1354239208580; Thu, 29 Nov 2012 17:33:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.58.1.9 with HTTP; Thu, 29 Nov 2012 17:33:08 -0800 (PST) In-Reply-To: References: From: Andrey Kuprianov Date: Fri, 30 Nov 2012 09:33:08 +0800 Message-ID: Subject: Re: Multiple key value query To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=bcaec501c0ccf7e45004cfac62c3 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec501c0ccf7e45004cfac62c3 Content-Type: text/plain; charset=ISO-8859-1 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 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 > > --bcaec501c0ccf7e45004cfac62c3--