Le 25/06/2010 12:17, Alexander Klimetschek a écrit :
On Fri, Jun 25, 2010 at 11:42, Gary Long<[email protected]> wrote:
Hello there :)
I'm using the fulltext search feature of Jackrabbit and i'm facing a little
problem with the colon character (:). For example, if I search for a mail
which subject is "Tr : Tr : your response", I can't find it. If I search for
"your response" the e-mail is found.
my sql query is :
SELECT * FROM mnt:resource WHERE (contains(jcr:text, '*tr: tr: your
response*') OR contains(jcr:name, '*tr: tr: your response*');
You should escape the query for the contains/jcr:contains function
using the Text.escapeIllegalXpathSearchChars helper from
jackrabbit-jcr-commons:
http://wiki.apache.org/jackrabbit/EncodingAndEscaping#Escaping_values_in_queries
Regards,
Alex
I tried this method but it didn't do anything : /
Here is my code :
String param = "Tr: Tr: your response";
String escapedParam =
org.apache.jackrabbit.util.Text.escapeIllegalXpathSearchChars(param);
String query = SELECT * FROM mnt:resource WHERE (contains(jcr:text, '*"+
escapedParam +"*') OR contains(jcr:name, '*"+ escapedParam +"*').
In debug mode, I looked at the value of textQuery in the query and it is
still "Tr: Tr your response". The colon character doesn't seems to be
escaped. : /
Regards,
Gary