lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: escaping special characters
Date Thu, 07 Aug 2008 04:35:10 GMT
can i escape built in lucene keywords like OR, AND aswell?

Aravind R Yarram

Chris Hostetter <> 
08/06/2008 07:05 PM
Please respond to


Re: escaping special characters

: String escapedKeywords = QueryParser.escape(keywords);
: Query query = new QueryParser("content", new
: StandardAnalyzer()).parse(escapedKeywords);
: this works with most of the special characters like * and ~ except \ . I
: can't do a search for a keyword like "ho\w" and get results.
: am I doing anything wrong here.

QueryParser.escape will in fact escape a backslash, but keep in mind 
StandardAnalyzer splits on backslash so that may be what's confusing you.


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

This message contains information from Equifax Inc. which may be confidential and privileged.
 If you are not an intended recipient, please refrain from any disclosure, copying, distribution
or use of this information and note that such actions are prohibited.  If you have received
this transmission in error, please notify by e-mail

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message