Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 55378 invoked from network); 20 Oct 2010 02:54:13 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Oct 2010 02:54:13 -0000 Received: (qmail 2522 invoked by uid 500); 20 Oct 2010 02:54:12 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 2484 invoked by uid 500); 20 Oct 2010 02:54:12 -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 2476 invoked by uid 99); 20 Oct 2010 02:54:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Oct 2010 02:54:11 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of couchdbuser@gmail.com designates 209.85.216.173 as permitted sender) Received: from [209.85.216.173] (HELO mail-qy0-f173.google.com) (209.85.216.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Oct 2010 02:54:04 +0000 Received: by qyl33 with SMTP id 33so990330qyl.11 for ; Tue, 19 Oct 2010 19:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=CLWGJ/pcMJzkbQjwErUfiCi/AxKfAnR/jd3f54XPlTA=; b=p+MWOod7sTZe2WSBZ54yPZujknLbZfoXyQb0zZ8EUKwJOO99sAC7EaZIpy0YW9ImE3 CGrVhbeK36lTnpF0TvNx0/nIOWJXL+Z6cKPbQKE86jaT+2fnbxV3zgkl2VyL6mwHom8x 6os+ZGUGjidM/DvGLVleb24BdMZnwPGgCsFKM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=hghXiC2Wev7iX42IlLMcfVnR38Y5uz4l5YaN0rTNegJQUI7Yf7+9ZakM7ocL+SI3/u P2CXf5K2K2MvxmcAx+D96/JhAWHDOg+Zp1QsrMBtsyK7I0XVuWAOdtKBBsKbh3NkN4HM grdIAXSW2jv/YXtM1BCn4R2J9s2PK3AetEFcg= MIME-Version: 1.0 Received: by 10.224.191.194 with SMTP id dn2mr2935863qab.256.1287543223340; Tue, 19 Oct 2010 19:53:43 -0700 (PDT) Received: by 10.229.95.145 with HTTP; Tue, 19 Oct 2010 19:53:43 -0700 (PDT) In-Reply-To: References: Date: Tue, 19 Oct 2010 22:53:43 -0400 Message-ID: Subject: Re: Query by specific date vs range From: couchdb user To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Lee, Here is a sample session creating a blank database, adding two records based on what you posted earlier, I create the view you specified and I query the view by key, see how if I do not encode the + sign, I get no rows. This is tested on Fedora 13, using the terminal (Bash) I hope this helps On Tue, Oct 19, 2010 at 7:17 PM, Lee Nelson wrote: > I will try that, but the plus sign is encoded (or not encoded) the > same whether I'm using "key=3D" or "startkey=3D &endkey=3D". =A0Why would= it > work with startkey/endkey but not with just key? > > On Tue, Oct 19, 2010 at 4:16 PM, couchdb user wro= te: >> the + sign has to be encoded too, at least I did that on my test db to >> get it to work >> >> On Tue, Oct 19, 2010 at 10:31 AM, Lee Nelson wrote: >>> I'm clearly doing something wrong, I just can't figure out what. =A0I >>> get different results from what it's suggested I should see. =A0CouchDB >>> sees this query: >>> [info] [<0.26537.9>] 10.0.1.8 - - 'GET' >>> /netelligence/_design/telemetry/_view/usage_dates?startkey=3D%222010/10= /15%2021:20:00%20+0000%22&endkey=3D%222010/10/15%2021:25:00%20+0000%22&incl= usive_end=3Dtrue >>> 200 >>> >>> And gives me a result of one row: >>> {"total_rows":1070,"offset":1,"rows":[ >>> {"id":"9856cb1e-4990-2a91-8507-f6abb266093c","key":"2010/10/15 >>> 21:20:00 +0000","value":null} >>> ]} >>> >>> What I'm really looking for is to be able to query a single value but >>> the query returns nothing. >>> >>> >>> >>> >>> On Mon, Oct 18, 2010 at 5:45 PM, Paul Davis wrote: >>>> The "key" URL parameter is in effect doing this: >>>> >>>> start_key=3D$(key)&end_key=3D$(key) >>>> >>>> View selection is about sorting. By default, it returns everything >>>> start_key <=3D row_key < end_key. If you add inclusive_end=3Dtrue to y= our >>>> query, it'll change the comparison operators to: start_key <=3D row_ke= y >>>> <=3D end_key. >>>> >>>> HTH, >>>> Paul Davis >>>> >>>> On Mon, Oct 18, 2010 at 7:29 PM, Lee Nelson wrote= : >>>>> When I query using a date range (startkey and endkey) I get a >>>>> response, however when I query by a single date (key=3D), I get no >>>>> response. =A0Examples: >>>>> >>>>> http://10.0.1.136:5984/netelligence/_design/telemetry/_view/usage_dat= es?key=3D"2010/10/15 >>>>> 21:20:00 +0000" >>>>> Returns: >>>>> {"total_rows":886,"offset":1,"rows":[]} >>>>> >>>>> However: >>>>> http://10.0.1.136:5984/netelligence/_design/telemetry/_view/usage_dat= es?startkey=3D"2010/10/15 >>>>> 20:15:00 +0000"&endkey=3D"2010/10/15 21:20:00 +0000" >>>>> Returns: >>>>> {"total_rows":888,"offset":0,"rows":[ >>>>> {"id":"7963df3f-a271-8da4-3b66-c5a0ed16d0bd","key":"2010/10/15 >>>>> 21:15:00 +0000","value":null} >>>>> ]} >>>>> >>>>> I'm also perplexed by the fact that the range query only returns one >>>>> row when there are entries at 21:15 and 21:20. =A0Why, when I query b= y >>>>> "key" do I get nothing and when I query by start- and endkey, do I >>>>> only get one of the two values in the range? =A0I've been banging my >>>>> head against this for two days. >>>>> >>>>> My map function: >>>>> function(doc) { >>>>> =A0 =A0if(doc.sampletime) { >>>>> =A0 =A0 =A0 =A0emit(doc.sampletime, null); >>>>> =A0 =A0} >>>>> } >>>>> >>>>> There is no reduce function. >>>>> >>>>> Here's an example document: >>>>> { >>>>> =A0 "_id": "ff41b06d-d19c-0275-abac-a38798e9bdbe", >>>>> =A0 "_rev": "1-3986507576f0da9fd5be20fd88724df1", >>>>> =A0 "category": "telemetry", >>>>> =A0 "type": "usage", >>>>> =A0 "measurement": "bandwidth", >>>>> =A0 "device": "rtr02-frfd", >>>>> =A0 "sampletime": "2010/10/17 06:35:00 +0000", >>>>> =A0 "ports": [ >>>>> =A0 =A0 =A0 { >>>>> =A0 =A0 =A0 =A0 =A0 "Gi8/36": [ >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 { >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InOctets": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InUcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InMcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InBcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutOctets": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutUcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutMcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutBcastPkts": 0 >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>>>> =A0 =A0 =A0 =A0 =A0 ], >>>>> =A0 =A0 =A0 =A0 =A0 "Gi4/0/5": [ >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 { >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InOctets": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InUcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InMcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "InBcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutOctets": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutUcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutMcastPkts": 0, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "OutBcastPkts": 0 >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>>>> =A0 =A0 =A0 =A0 =A0 ] >>>>> =A0 =A0 =A0 } >>>>> =A0 ] >>>>> } >>>>> >>>> >>> >> >