Skip to content
This repository

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

andreyvk opened this Issue July 17, 2012 · 4 comments

2 participants

Andrey Robert Newson


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:
\"(\" ...
\"*\" ...
<QUOTED> ...
<TERM> ...
\"[\" ...
\"{\" ...
<NUMBER> ...

"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?

Robert Newson

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).

Robert Newson rnewson closed this July 17, 2012

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

Robert Newson

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
Something went wrong with that request. Please try again.