lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aravind.Yar...@equifax.com
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?

Regards, 
Aravind R Yarram
 





Chris Hostetter <hossman_lucene@fucit.org> 
08/06/2008 07:05 PM
Please respond to
java-user@lucene.apache.org


To
java-user@lucene.apache.org
cc

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


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org



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 postmaster@equifax.com.

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