cannot search in fields with dash #154

pwde opened this Issue Mar 7, 2012 · 3 comments


None yet
2 participants

pwde commented Mar 7, 2012

Hello Robert,

first, thanks for couchdb-lucene. We used couchdb and couchdb-lucene for the last 6 month.

But I run into a strange issue when using lucene-fiels with dash AND without wildcards:

curl -X GET
{"reason":"Bad query syntax: Cannot parse 'attr-with-dash:value': Field 'attr-with-dash' not recognized.","code":400}

When include a wildcard, then I got the result:

curl -X GET*

Using lucene-fileds without dashes, I got the expected results:

curl -X GET

The related doc:
"_id": "04b861b48b6fe810931ff34ec4be3577",
"_rev": "5-ab29da369465b362a76c5aa16e755162",
"template": "test-search",
"attr": {
"attrWithoutDash": [
"attr-with-dash": [

The search function:
function(doc) {
var ret = new Document();
if (doc.attr) {
for (var aname in doc.attr) {
var values = doc.attr[aname];
for (var i=0; i<values.length; i++) {
ret.add(values[i], {'field':aname});
return ret;

May be I do something wrong...

Best regards,


rnewson commented Mar 7, 2012

It's a bug. There's some post-processing for term queries (your "foo", but not your "foo*") that examines the field name, looking for the type ("foo", for example). That examination does not expect dashes in the field name. I can easily fix that.

pwde commented Mar 7, 2012

a fix would be great. :-)

rnewson closed this in 3f20378 Mar 7, 2012

pwde commented Mar 7, 2012

thanks. successfully verified.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment