Problems searching for tokens like "AND" and "OR" #165

andreyvk opened this Issue Jul 17, 2012 · 4 comments


None yet
2 participants


Here's what i get when i search with "AND" or "OR" terms:

The query itself, for instance "name:AND~0.4"

Response from couchdb-lucene:

{"reason": "Bad query syntax: Cannot parse 'name:AND~0.4': Encountered " "AND "" at line 1, column 41.
Was expecting one of:
"(" ...
"*" ...
"[" ...
"{" ...

"code": 400}

Is it a bug or specifics of underlying Lucene processing? If it's Lucene specific, then what would be the best way to handle this problem?


rnewson commented Jul 17, 2012

AND and OR are part of the query syntax. try name:"AND" and name:"OR" instead, though bear in mind that both words are part of the standard analyzer's stop word list and are not indexed (as they are generally regarded as poor search terms).

rnewson closed this Jul 17, 2012

I did. But then it wouldn't work with fuzzy operator....


rnewson commented Jul 18, 2012

You can escape it, I think. However, searching for "and" will return
nothing, as it is not indexed. Searching for words like "and" seems an
even less useful query. What are you trying to do?

Sent from my iPhone

On 18 Jul 2012, at 02:32, Andrey

I did. But then it wouldn't work with fuzzy operator....

Reply to this email directly or view it on GitHub:
#165 (comment)

I am searching on company names. So I must treat OR and AND as part of name (e.g. company name is transliterated from a foreign name... so you could have smth like "Or & Ar Co. Ltd." ).

I applied a per-field simple analyzer on a company name and it seems to be OK for now. Hope that was a right choice :)

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