You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Amin Mohammed-Coleman <am...@gmail.com> on 2009/10/22 14:19:45 UTC
Special Characters and QueryParser
Hi
I am looking at handling special characters in the query as using certain
characters cause an exception. I looked at QueryParser.escape(..) to handle
this. It works to a certain extent for example using '!' doesn't cause an
exception. However when I use a wildcard then the wildcard is ignored. For
example ref* is converted to ref. I know that the escape method looks for
particular special characters and one of them is '*'. Is there a way to
handle special characters and not remove certain characters for example
'?'. I'm guessing I would need to do something programmatically and add \
to the character and not apply it to * or ? or - or +.
Any help would be appreciated.
cheers
Amin