Michael Busch
added a comment - 17/May/07 18:18 You are right Yonik, || is reserved.
The QueryParser itself works correctly:
"|| test ||" yields a ParseException, which is correct because in this case || means OR
"|| test ||" yields "|| test ||", this is correct, too, because the two | are escaped
The problem here is the escape() method:
/**
Returns a String where those characters that QueryParser
expects to be escaped are escaped by a preceding <code>\</code>.
*/
public static String escape(String s);
It escapes chars like +, -, ! and so on. Example:
escape("++ test ++") yields "++ test ++"
but
escape("|| test ||") yields "|| test ||".
I believe to be consistent escape() should escape the two chars | and & as well, no?

Yonik Seeley
added a comment - 17/May/07 17:43 Sorry, I don't quite understand the problem. Could someone provide an actual query string that should work but doesn't? "||" is reserved since it means OR, AFAIK.