You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Marcos Zanona (JIRA)" <ji...@apache.org> on 2010/02/28 22:34:05 UTC

[jira] Created: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

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/dev@couchdb.apache.org/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.


Re: [jira] Commented: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Mar 29, 2010 at 12:48 AM, Zachary Zolton
<za...@gmail.com> wrote:
> You're totally right; there wholly different problems. I've been
> trying so many experiments around URL rewriting lately, I think got a
> crossed wire! (*_*)
>
Anyway could you explain the pb in detail ? The case you mention works
in unitests and also in app here. If the problem is testing integer,
you can aloways format your int as str in the key.

- benoit

Re: [jira] Commented: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

Posted by Zachary Zolton <za...@gmail.com>.
You're totally right; there wholly different problems. I've been
trying so many experiments around URL rewriting lately, I think got a
crossed wire! (*_*)

On Sun, Mar 28, 2010 at 5:32 PM, Benoit Chesneau <bc...@gmail.com> wrote:
> On Mon, Mar 29, 2010 at 12:13 AM, Zachary Zolton
> <za...@gmail.com> wrote:
>> 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.
>>
>>
> Uh ? Could you give exact example ? I fail to see how it's related to
> the ticket. Thanks.
>
> - benoit
>

Re: [jira] Commented: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

Posted by Benoit Chesneau <bc...@gmail.com>.
On Mon, Mar 29, 2010 at 12:13 AM, Zachary Zolton
<za...@gmail.com> wrote:
> 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.
>
>
Uh ? Could you give exact example ? I fail to see how it's related to
the ticket. Thanks.

- benoit

Re: [jira] Commented: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

Posted by Zachary Zolton <za...@gmail.com>.
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)
<ji...@apache.org> 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/dev@couchdb.apache.org/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.
>
>

[jira] Closed: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benoit Chesneau closed COUCHDB-677.
-----------------------------------

         Assignee: Benoit Chesneau
    Fix Version/s: 1.0
       Resolution: Fixed

> 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
>            Assignee: Benoit Chesneau
>             Fix For: 1.0
>
>
> 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/dev@couchdb.apache.org/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.


[jira] Commented: (COUCHDB-677) Rewrite Handler not translating variables inside array values.

Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
    [ 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/dev@couchdb.apache.org/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.