Nope, I'm not having any luck, either...

What I had working was a redirect like so:

{
    "from": "/events/:year",
    "to": "_list/event-list/events-by-year",
    "query": {
      "key": ":year",
      "reduce": false,
      "include_docs": true
    }
  }

Because the :year bindvar only needed to handle numbers, which
technically work without any JSON encoding.

As soon as I tried using a string parameter, as a bindvar, I'd get:

{
    "error": "bad_request"
    "reason": "invalid UTF-8 JSON"
}

So, yes, we need JSON encoding of key, startkey and endkey.


On Sun, Mar 28, 2010 at 10:29 AM, Benoit Chesneau (JIRA)
<[email protected]> wrote:
>
>    [ 
> https://issues.apache.org/jira/browse/COUCHDB-677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850685#action_12850685
>  ]
>
> Benoit Chesneau commented on COUCHDB-677:
> -----------------------------------------
>
> fixed in latest head.
>
>> Rewrite Handler not translating variables inside array values.
>> --------------------------------------------------------------
>>
>>                 Key: COUCHDB-677
>>                 URL: https://issues.apache.org/jira/browse/COUCHDB-677
>>             Project: CouchDB
>>          Issue Type: Improvement
>>          Components: HTTP Interface
>>    Affects Versions: 0.11
>>         Environment: Mac OSX 10.6.2 - Intel Core 2 Duo 2.4 - CouchDb 
>> 0.11.0b917241
>>            Reporter: Marcos Zanona
>>
>> It seems that it's not possible at the moment create url rewrites with 
>> params such startkey,endkey or any query with an array value like "startkey" 
>> : [":user",0]
>> I've found the same issue listed here: 
>> http://www.mail-archive.com/[email protected]/msg06925.html where 
>> benoitc tells it should work and zachary told it's working for him, but 
>> mysteriously, not for me
>> [
>>     {
>>       "from"  : ":user",
>>       "to"    : "_view/all",
>>       "method": "GET",
>>       "query" : {
>>                   "startkey": [":user","a"],
>>                   "endkey": [":user", "z"]
>>                 }
>>     }
>> ]
>> it's a very simple rewrite, but I'm getting this when calling it:
>> http://localhost:5984/test/_design/core/_rewrite/ludicco
>> ----
>> [info] [<0.3063.0>] 127.0.0.1 - - 'GET' 
>> /test/_design/core/_view/all?startkey=%5B%22%3Auser%22%2C%22a%22%5D&endkey=%5B%22%3Auser%22%2C%22z%22%5D&user=ludicco
>>  200
>> But the same works when using values such "startkey" : ":user".
>> It seems that the rewrite handler expects  only a simple string as 
>> placeholder.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

Reply via email to