Following on...
My (possibly mis)understanding is that
Text.escapeIllegalXpathSearchChars(String s) is incomplete and should be
covering all the characters in
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Escaping%20Special%20Characters
Since escapeIllegalXpathSearchChars "[is a] method you should use for calls to
jcr:contains(...)" and currently does NOT actually contain escaping for XPath's
invalid single quote ('') - I believe the intention of the method was mainly
just to prevent Lucene issues.
Thus am I correct in that really all that needs to be done it to replace the
existing escapeIllegalXpathSearchChars with:
public static String escapeIllegalXpathSearchChars(String s) {
// Escape Lucene special chars & XPath illegal chars
s = org.apache.lucene.queryParser.QueryParser.escape(s);
// Escape XPath illegal single quotes
return s.replaceAll("'", "''");
}
?
I think this would prevent both XPath and Lucene issues as the name of the
method suggests (for as long as the Lucene special characters are also illegal
XPath characters) or do I actually need to escape twice, once for jcr's xpath,
once for lucene as per my last posting....?
Benjamin