jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Long <l...@magillem.com>
Subject Re: How to handle the colon character within fulltext search?
Date Fri, 25 Jun 2010 11:59:35 GMT
Le 25/06/2010 12:17, Alexander Klimetschek a écrit :
> On Fri, Jun 25, 2010 at 11:42, Gary Long<long@magillem.com>  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




Mime
View raw message