couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 7zark7 <7za...@gmail.com>
Subject Re: Rewrite + List + View problem
Date Tue, 15 Jun 2010 05:07:02 GMT
Hi Benoit,

I still see the same behavior on trunk build: 0.12.0a954405

I see there was already an issue for this: 
https://issues.apache.org/jira/browse/COUCHDB-677

But you said you fixed in latest head back in March.  Is this correct?

Thanks



On 6/11/10 7:35 AM, Benoit Chesneau wrote:
> Could you try latest trunk and let me know if it fixes your error? If
> not please open a ticket i will fix it tomorrow.
>
> benoit.
>
> Sent from my iphone
>
> On Wednesday, June 9, 2010, 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
>>


Mime
View raw message