incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anh <7za...@gmail.com>
Subject Re: Rewrite + List + View problem
Date Wed, 09 Jun 2010 19:44:06 GMT
This is CouchDBX 0.11 release, I will try trunk out, thanks.


On Wed, Jun 9, 2010 at 12:32 PM, Benoit Chesneau <bchesneau@gmail.com> wrote:
> 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.  The 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=true&startkey=[123456,%22%22]&endkey=[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:
>>
>> {
>>        "from": "/owner/:owner/list",
>>        "to": "_list/list/view",
>>        "method": "GET",
>>        "query": {
>>                "group": true,
>>                "startkey": [":owner", ""],
>>                "endkey": [":owner", "\\u9999"]
>>        }
>> }
>>
>> However, this is getting rewritten to the following:
>>
>> 'GET' /db/_design/temp/_list/list/view?startkey=%5B%22%3Aowner%22%2C%22%22%5D&endkey=%5B%22%3Aowner%22%2C%22%5C%5Cu9999%22%5D&group=true&owner=123456
>>
>> 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?  (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
>

Mime
View raw message