couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien Bénel <aurelien.be...@utt.fr>
Subject Re: Rewriting a parameterized URL
Date Sat, 05 Jun 2010 11:53:58 GMT
> Oh what you would like is :
> [
> {
>  "from": "/item",
>  "to": "_list/mapping/kwic",
>  "query": {
>    "startkey": [":corpus"],
>    "endkey": [":corpus",{}]
>  }
> }
> ]
> and just pass corpus=corpus as argument in your client url : /item?corpus= ...


Thank you for your advice. However i got:

1> [debug] [<0.21204.0>] 'GET' /cassandre/_design/cassandre/_rewrite/item?corpus=MISS
{1,1}
[snip]
1> [debug] [<0.21204.0>] rewrite to "/cassandre/_design/cassandre/_list/mapping/kwic?startkey=%5B%22%3Acorpus%22%5D&endkey=%5B%22%3Acorpus%22%2C%7B%7D%5D&corpus=MISS"


While i wanted it to be rewritten to:
"/cassandre/_design/cassandre/_list/mapping/kwic?startkey=%5B%22MISS%22%5D&endkey=%5B%22MISS%22%2C%7B%7D%5D

In other words, it seems that it doesn't understand anymore that :corpus is a variable which
is instantiated to "MISS".

Any further idea?


Regards,

Aurélien


Original post:

> Hi there,
> 
> I am now trying to rewrite URLs...
> 
> With a nightly build of CouchDB (to fix COUCHDB-677 issue), I successfully used this
rewrite rule:
> [
> {
>   "from": "/item/:corpus",
>   "to": "_list/mapping/kwic",
>   "query": {
>     "startkey": [":corpus"],
>     "endkey": [":corpus",{}]
>   }
> }
> ]
> 
> However in order to implement the given specification, I would need something like this
rule:
> [
> {
>   "from": "/item/?corpus=:corpus",
>   "to": "_list/mapping/kwic",
>   "query": {
>     "startkey": [":corpus"],
>     "endkey": [":corpus",{}]
>   }
> }
> ]
> 
> I get:
> 1> [debug] [<0.3235.0>] 'GET' /cassandre/_design/cassandre/_rewrite/item/?corpus=MISS
{1,1}
> [snip]
> 1> [debug] [<0.3235.0>] OAuth Params: [{"corpus","MISS"}]
> [snip]
> 1> [debug] [<0.3235.0>] httpd 404 error response:
> {"error":"not_found","reason":"missing"}
> 
> Any idea of what should be done so that my parameters are not interpreted as OAuth parameters
and so that they are sent to my rewrite rule instead?
> 
> 
> Regards,
> 
> Aurélien

Mime
View raw message