lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anne <>
Subject Escaping special character -
Date Tue, 18 Oct 2011 18:47:07 GMT
I have a field that is not tokenized. Its value can contain a "-".
For instance it could be "project-test". I have read that I need to escape
this special character with a \
I am using the following code (StandardAnanyzer):
 Query query = queryParser.parse("field:project\\-test);

and it doesn't retrieve my document.

Is it because I need to use a TermQuery?
I have tried with a TermQuery and it seems that in this case I don't need to
escape the "-".

Or is it because of the analyzer?

Any help will be appreciated. Thanks a lot,

View this message in context:
Sent from the Lucene - Java Developer mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message