You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Deistl Ross <de...@me.com> on 2011/04/03 21:44:33 UTC

rewrite startkey endkey

After searching various sources I can't find a solution, or I don't understand.  If have a string "endkey=%22471345585383%22&startkey=%22471345585383%22&descending=true" when sent to the appropriate _view yields the expected result. I create this rewrite, 

"from": "/stufffixq/:val",
       "to": "_view/test6",
       "method": "GET",
       "descending": "TRUE",
       "query": {
           "endkey": [":val"],
           "startkey": [":val",{}]

This  string does not work, producing this response,

       /_view/test6?endkey=%5B%22endkey%3D%5C%22471345585385%5C%22%26startkey%3D%5C%22471345585383%5C%22%22%5D&startkey=%5B%22endkey%3D%5C%22471345585385%5C%22%26startkey%3D%5C%22471345585383%5C%22%22%2C%7B%7D%5D&val=endkey%3D%22471345585385%22%26startkey%3D%22471345585383%22 200

This response ignores the start and end keys and returns all the results for the _view.

The non-rewrite request show this response,
_view/test6?endkey=%22471345585383%22&startkey=%22471345585383%22&descending=true 200

And returns the correct results


How should the rewrite be written to produce the correct result?



Re: rewrite startkey endkey

Posted by Benoit Chesneau <bc...@gmail.com>.
On Sun, Apr 3, 2011 at 9:44 PM, Deistl Ross <de...@me.com> wrote:
> After searching various sources I can't find a solution, or I don't understand.  If have a string "endkey=%22471345585383%22&startkey=%22471345585383%22&descending=true" when sent to the appropriate _view yields the expected result. I create this rewrite,
>
> "from": "/stufffixq/:val",
>       "to": "_view/test6",
>       "method": "GET",
>       "descending": "TRUE",
>       "query": {
>           "endkey": [":val"],
>           "startkey": [":val",{}]
>
> This  string does not work, producing this response,
>
>       /_view/test6?endkey=%5B%22endkey%3D%5C%22471345585385%5C%22%26startkey%3D%5C%22471345585383%5C%22%22%5D&startkey=%5B%22endkey%3D%5C%22471345585385%5C%22%26startkey%3D%5C%22471345585383%5C%22%22%2C%7B%7D%5D&val=endkey%3D%22471345585385%22%26startkey%3D%22471345585383%22 200
>
> This response ignores the start and end keys and returns all the results for the _view.
>
> The non-rewrite request show this response,
> _view/test6?endkey=%22471345585383%22&startkey=%22471345585383%22&descending=true 200
>
> And returns the correct results
>
>
> How should the rewrite be written to produce the correct result?
>
>
>
This have been solved here:

https://issues.apache.org/jira/browse/COUCHDB-1074

Iwill commit it here tomorrow probably.

- benoît