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 Mon, 07 Jun 2010 15:30:04 GMT
Good evening,

Here are more thoughts about URL rewriting...  
I'm wondering now about what should be done when a parameter is not set.

For example, it would be nice to have both:
/cassandre/_design/cassandre/_rewrite/item/?corpus=MISS  rewritten to
/cassandre/_design/cassandre/_list/mapping/kwic?startkey=["MISS"]&endkey=["MISS",{}]
and
/cassandre/_design/cassandre/_rewrite/item/  rewritten to
/cassandre/_design/cassandre/_list/mapping/kwic


Maybe this could be done with a single rewrite rule (with  unset variables as a special case):
[
  {
    "from": "item/",
    "to": "_list/mapping/kwic",
    "query": {
      "startkey": [":corpus"],
      "endkey": [":corpus",{}]
    }
  }
]

... or maybe with a sequence of rules, with the next rule being tested when the last one failed:
[
  {
    "from": "item/",
    "to": "_list/mapping/kwic",
    "query": {
      "startkey": [":corpus"],
      "endkey": [":corpus",{}]
    }
  }, {
    "from": "item/",
    "to": "_list/mapping/kwic"
  }
]

Does one of these solutions makes sense?


Regards,

Aurélien 
Mime
View raw message