CouchDB Lucene How to URL Encode Query containing Minus (-)

Posted by Peter on Stack Overflow See other posts from Stack Overflow or by Peter
Published on 2014-08-20T15:37:32Z Indexed on 2014/08/21 4:20 UTC
Read the original article Hit count: 191

Filed under:
|
|

I'd like to query text containing a minus (-) Sign, e.g.

foo-bar 

with a couchdb lucene fulltext query. Following lucene rules I'd have to escape the minus, resulting in

foo\-bar

Last I'd have to urlencode the backslash resulting in

foo%5C-bar

So the complete url would be:

http://127.0.0.1:5984/_fti/local/db/_design/foo/by_subject?q=foo%5C-bar

Neither works. The result is always split in two phrases

"q":"default:foo default:bar"

Leading to documents containing only foo or bar being found also.

Thanks for your help!

© Stack Overflow or respective owner

Related posts about lucene

Related posts about couchdb