From dev-return-9151-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Mon Mar 15 23:18:53 2010 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 4709 invoked from network); 15 Mar 2010 23:18:53 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Mar 2010 23:18:53 -0000 Received: (qmail 92634 invoked by uid 500); 15 Mar 2010 23:18:05 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 92592 invoked by uid 500); 15 Mar 2010 23:18:05 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 92584 invoked by uid 99); 15 Mar 2010 23:18:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Mar 2010 23:18:05 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=10.0 tests=AWL,FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of robert.newson@gmail.com designates 74.125.82.180 as permitted sender) Received: from [74.125.82.180] (HELO mail-wy0-f180.google.com) (74.125.82.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Mar 2010 23:17:59 +0000 Received: by wya21 with SMTP id 21so1675104wya.11 for ; Mon, 15 Mar 2010 16:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ikBeRe4oow4spUvDeuPtKfFaDH4H4VGCIu/u+Iesr1Q=; b=NWkr/BT0PTVwsGS9oyfSFJPwBsHTS3gRxuv4JMzjkZBxgT1vjaz2DNeU1mIBSTT95e BGYA0/281VXNssKCu+FvwN2oHIZPQlTKQ1qW/UnbSauH4j44rVQjLX40FsxSjr+mixbe 7oBnn497Kr75tJImVM8jmzUQmDkIA2QPtmXw4= 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=xVH660fT2F7YvX67oLU0ZaXbw+B/V81TqyWoEHPE+Et5YCAjkISZLNFEzOOuuONP/e yhffOgdTmGOz/lLtaJnbEwMKi/oX3x5r+ynlbA3bJODoE7+qiHh8vfvB+ouLs1meXHfU sO664CTXo0AYNeO52ZMMRVo6L2/gMhZkx/yvo= MIME-Version: 1.0 Received: by 10.216.90.6 with SMTP id d6mr75436wef.89.1268695057900; Mon, 15 Mar 2010 16:17:37 -0700 (PDT) In-Reply-To: References: Date: Mon, 15 Mar 2010 23:17:37 +0000 Message-ID: <46aeb24f1003151617l75d26033i3837cd61154f16a7@mail.gmail.com> Subject: Re: URL rewriter - bind variables and complex keys From: Robert Newson To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This also scratches an itch for me, happy to help out. On Mon, Mar 15, 2010 at 10:50 PM, Zachary Zolton wrote: > Thanks, Benoit! I plan on using this feature heavily... (^_^) > > I created the JIRA issue: > https://issues.apache.org/jira/browse/COUCHDB-699 > > On Mon, Mar 15, 2010 at 5:24 PM, Benoit Chesneau wr= ote: >> On Mon, Mar 15, 2010 at 9:55 PM, Zachary Zolton >> wrote: >>> Howdy, >>> >>> I have the following rewrite rule: >>> >>> =A0{ >>> =A0 =A0"from": "/events/:year", >>> =A0 =A0"to": "_list/event-list/events-by-date", >>> =A0 =A0"method": "GET", >>> =A0 =A0"query": { >>> =A0 =A0 =A0"startkey": [":year"], >>> =A0 =A0 =A0"endkey": [":year", {}] >>> =A0 =A0} >>> =A0}, >>> >>> Now, I'll try to hit this URL for a specific year: >>> >>> $ curl http://localhost:6666/db/_design/ddoc/_rewrite/events/1975 >>> >>> Unfortunately, I didn't get the expected data. (;_;) >>> >>> Here's the log entry: >>> >>> [info] [<0.1522.0>] 127.0.0.1 - - 'GET' >>> /db/_design/ddoc/_list/event-list/events-by-date?startkey=3D%5B%22%3Aye= ar%22%5D&endkey=3D%5B%22%3Ayear%22%2C%7B%7D%5D&year=3D1975 >>> 200 >>> >>> Noticing that the start and end keys both contain %3Ayear, I'm >>> guessing that it just URL encoded the string ":year". So, I'm guessing >>> the rewriter module isn't looking for bind variables in key parameters >>> when the value is a list. >> >> This behaviour isn't expected yet. I will commit a patch that allos >> this this week. >>> >>> Shall I open up a ticket in JIRA? >>> >>> >> Sure it's better for tracking anyway. >> >> - benoit >> >