Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 46966 invoked from network); 9 Jun 2010 19:44:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Jun 2010 19:44:35 -0000 Received: (qmail 28232 invoked by uid 500); 9 Jun 2010 19:44:34 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 28181 invoked by uid 500); 9 Jun 2010 19:44:34 -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 28173 invoked by uid 99); 9 Jun 2010 19:44:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jun 2010 19:44:34 +0000 X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=AWL,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of 7zark7@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jun 2010 19:44:27 +0000 Received: by vws5 with SMTP id 5so3172729vws.11 for ; Wed, 09 Jun 2010 12:44:06 -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=eDUNkNzNzh6PmfjRpA0RKS8TDXSBgp1f4HTLhG5EaPI=; b=KRu+Otf9C/LjfDI7cITo31AdTC0o0L4obvfiFeMrsOC6n/HEenD5IMc6198asmd5uk d74Czp9zXzDFG5eLT9pDCy93Ce9zIkOceX7Snl48qU7sQkf2njfuBpBh1148eGckPzzb pq0GRHaZSc8RHV3mhSYqZ2mypoyGTa/D/5X5M= 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=hXV83wi0kZ51/wf0lAu9Pa47unxx3s4v8COsKSv73uZ/aoY/9E4S9fBBXL6/g3bwJg 7jHpLM+yHpx4RtAA4YYqPcF4Xye216c1j9F9vyd0iIYBDp5r3DA05TM150p/0WLP1JXS mepiJ+hsMPyunLXjDnXLdiVwY10pXWT0TNMRQ= MIME-Version: 1.0 Received: by 10.224.36.92 with SMTP id s28mr255870qad.293.1276112646428; Wed, 09 Jun 2010 12:44:06 -0700 (PDT) Received: by 10.220.177.5 with HTTP; Wed, 9 Jun 2010 12:44:06 -0700 (PDT) In-Reply-To: References: Date: Wed, 9 Jun 2010 12:44:06 -0700 Message-ID: Subject: Re: Rewrite + List + View problem From: Anh <7zark7@gmail.com> To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is CouchDBX 0.11 release, I will try trunk out, thanks. On Wed, Jun 9, 2010 at 12:32 PM, Benoit Chesneau wrot= e: > On Wed, Jun 9, 2010 at 5:32 PM, Anh <7zark7@gmail.com> wrote: >> Hi, >> >> I'm trying to use the rewrite handler to clean up a list function URL, >> but doesn't seem to work correctly. =A0The view and list function work >> fine without the rewrite. >> >> The view and reduce output complex keys like so: >> >> {"rows":[ >> {"key":[123456,"Alpha],"value":2}, >> {"key":[985323,"Bravo"],"value":1}, >> ]} >> >> and the view and list URL work correctly using these parameters: >> >> http://couch:5984/db/_design/temp/_list/list/view?group=3Dtrue&startkey= =3D[123456,%22%22]&endkey=3D[123456,%22\u9999%22] >> >> >> (Using vhosts) I'm trying to rewrite the ugly URL and parameters to be: >> /owner/:owner/list >> >> (where :owner is a numeric value) >> >> The rewrite I wrote looks like this: >> >> { >> =A0 =A0 =A0 =A0"from": "/owner/:owner/list", >> =A0 =A0 =A0 =A0"to": "_list/list/view", >> =A0 =A0 =A0 =A0"method": "GET", >> =A0 =A0 =A0 =A0"query": { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"group": true, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"startkey": [":owner", ""], >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"endkey": [":owner", "\\u9999"] >> =A0 =A0 =A0 =A0} >> } >> >> However, this is getting rewritten to the following: >> >> 'GET' /db/_design/temp/_list/list/view?startkey=3D%5B%22%3Aowner%22%2C%2= 2%22%5D&endkey=3D%5B%22%3Aowner%22%2C%22%5C%5Cu9999%22%5D&group=3Dtrue&owne= r=3D123456 >> >> which does not throw an error, but returns an empty view since the >> URL-encoded keys do not match anything. >> >> Is there some way to do this with CouchDB rewrites? =A0(Passing the >> startkey and endkey parameters to the "nice" URL would defeat the >> purpose of this rewrite) >> >> >> Thanks >> > > Is this on latest trunk ? Could you try latest and let me know if your > problem is solved ? > > - benoit >