rnewson/couchdb-lucene — Issue #143: lucene queries for design documents with "::" in the id return 400 "no_such_view" responses
Author: moonmaster9000
Created: 2011-11-23 18:57:15+00:00
State: open

Running CouchBase Server Community Edition on Mac OS X, version 1.1.1.
Running CouchDBLucene on Mac OS X, version 0.8.0 (built today from fresh clone of couchdb-lucene repo)

Steps to reproduce:

```
~ λ export COUCHBASE="http://localhost:5984"
~ λ curl $COUCHBASE
{"couchdb":"Welcome","version":"1.1.1"}
~ λ curl -X PUT $COUCHBASE/query_test
{"ok":true}
~ λ cat > design_with_colons.js
{
"_id": "_design/Some::Model",
"language": "javascript",
"fulltext": {
"by_fulltext": {
"index": "\n function(doc) {\n var ret = new Document();\n function idx(obj) {\n for (var key in obj){\n switch (typeof obj[key]) {\n case 'object':\n idx(obj[key]);\n break;\n case 'function':\n break;\n default:\n ret.add(obj[key]);\n break;\n }\n }\n };\n\n if (doc['couchrest-type'] == 'Some::Model') {\n idx(doc);\n\n if (doc._attachments) {\n for (var i in doc._attachments) {\n ret.attachment('attachment', i);\n }\n }\n }\n return ret;\n }\n "
}
}
}
~ λ cat > design_without_colons.js
{
"_id": "_design/SomeModel",
"language": "javascript",
"fulltext": {
"by_fulltext": {
"index": "\n function(doc) {\n var ret = new Document();\n function idx(obj) {\n for (var key in obj){\n switch (typeof obj[key]) {\n case 'object':\n idx(obj[key]);\n break;\n case 'function':\n break;\n default:\n ret.add(obj[key]);\n break;\n }\n }\n };\n\n if (doc['couchrest-type'] == 'SomeModel') {\n idx(doc);\n\n if (doc._attachments) {\n for (var i in doc._attachments) {\n ret.attachment('attachment', i);\n }\n }\n }\n return ret;\n }\n "
}
}
}
~ λ curl -X PUT "$COUCHBASE/query_test/_design/Some::Model" -d @design_with_colons.js
{"ok":true,"id":"_design/Some::Model","rev":"1-ea320b040c7f01626e1100d9f6ca8146"}
~ λ curl -X PUT "$COUCHBASE/query_test/_design/SomeModel" -d @design_without_colons.js
{"ok":true,"id":"_design/SomeModel","rev":"1-2462bbb837299ba95a2f02e05abe67fe"}
~ λ curl -H "Content-Type:application/json" $COUCHBASE/query_test/_fti/_design/SomeModel/by_fulltext?q=hi
{"limit":25,"etag":"1258f384d61858a8","fetch_duration":0,"q":"default:hi","search_duration":0,"total_rows":0,"skip":0,"rows":[]}
~ λ curl -H "Content-Type:application/json" "$COUCHBASE/query_test/_fti/_design/Some::Model/by_fulltext?q=hi"
{"reason":"no_such_view","code":400}
```