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 D0AFDDA7A for ; Fri, 30 Nov 2012 01:48:03 +0000 (UTC) Received: (qmail 78570 invoked by uid 500); 30 Nov 2012 01:48:02 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 78534 invoked by uid 500); 30 Nov 2012 01:48:02 -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 78524 invoked by uid 99); 30 Nov 2012 01:48:02 -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:48:02 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.217.180] (HELO mail-lb0-f180.google.com) (209.85.217.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 01:47:55 +0000 Received: by mail-lb0-f180.google.com with SMTP id gj3so34524lbb.11 for ; Thu, 29 Nov 2012 17:47:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:from:date :message-id:subject:to:content-type:x-gm-message-state; bh=tfxImrSAFom4OEMt0aFEy2IlTYFfMsY52KTxiC24omA=; b=ElGXrFxSo8eE23feWYY+/ZxkijIsVKF4l4j4LPG3AQa4vJMzgmCSBdvn0Lg7OohCSO E12u7EfRKS3YdBywgMywxxQ2dcY8+Cx6xX3xsqmFocWdS+ZP4nCHtZBLlwnzLqAGmi+t MmFTD47P2HA7lk1nWIdPowzL0oXzojm3XuYEkRv6dXWw95NBgXBuwhTDqLlXmo+wnTjB 1U9obxwWYDtjgQZl3pSrlm95mSnoLV5xDBHIP7AT5e8CYtfjsZW0m8UqwXODFjHOUYsW y/P4OYjGh5oEa/lvsyyPRlmB5+LWXHfku/iCHHS877+90h09O+OvkYOX8IZdfReH7gN+ ppXw== Received: by 10.152.144.164 with SMTP id sn4mr23447041lab.57.1354240053576; Thu, 29 Nov 2012 17:47:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.0.3 with HTTP; Thu, 29 Nov 2012 17:47:13 -0800 (PST) X-Originating-IP: [68.5.117.177] In-Reply-To: References: From: Mark Hahn Date: Thu, 29 Nov 2012 17:47:13 -0800 Message-ID: Subject: Re: Multiple key value query To: user Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnu6xoBJ8aSvMSxeh3ONkeitajc+g2gDGdTxTqN0UBh0L2sc6fAZeZcLuILiuVDeSaEmlRb X-Virus-Checked: Checked by ClamAV on apache.org > Another easy, but very straightforward way would be to do query 3 times I had a lot of trouble when switching from sql to nosql feeling guilty when doing multiple requests. I've gotten over that now. Doing 3 fast simple requests is little to no worse than doing an sql query. This assumes a local DB which is all I've used so far. On Thu, Nov 29, 2012 at 5:33 PM, Andrey Kuprianov wrote: > 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 >> >>