jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg <ovarak...@googlemail.com>
Subject Re: Full text search failed
Date Mon, 30 Nov 2009 16:02:32 GMT

Hello,

I have just made the experience that Text.escapeIllegalXpathSearchChars
doesn't work correct if the whole phrase is surrounded by \" (double quotes
within String) and the sign \" is the last sign. The mentioned below
exception org.apache.lucene.queryParser.ParseException will be thrown.

Instead of call Text.escapeIllegalXpathSearchChars(q).replaceAll("'", "''")
(see commendation  http://wiki.apache.org/jackrabbit/EncodingAndEscaping
http://wiki.apache.org/jackrabbit/EncodingAndEscaping ) the simple
replacement replaceAll("'", "''") should be enough. Or the method
Text.escapeIllegalXpathSearchChars should be fixed.

Best regards.
Oleg.


Oleg wrote:
> 
> Hello,
> 
> I have one more question related to the full text search. I use
> instructions from  http://wiki.apache.org/jackrabbit/EncodingAndEscaping
> http://wiki.apache.org/jackrabbit/EncodingAndEscaping  to escape values in
> queries. Well. But the method Text.escapeIllegalXpathSearchChars does
> something strange replacements. If I want to search a whole phrase I
> surround the text with double quotes. This is described in JCR 170
> (section 6.6.5.2 jcr:contains Function) A term may be either a single word
> or a phrase delimited by double quotes ("). Well. I write now a String
> "\"Have much fun\"" and pass it through
> Text.escapeIllegalXpathSearchChars. An exception is thrown:
> 
> javax.jcr.RepositoryException: Exception building query:
> org.apache.lucene.queryParser.ParseException: Cannot parse '"Have much
> fun\"': Lexical error at line 1, column 17.  Encountered: <EOF> after :
> "\"Have much fun\\\""
> 
> How can I force to search phrases as a whole text?
> 
> Best regards.
> Oleg.
> 

-- 
View this message in context: http://n4.nabble.com/Full-text-search-failed-tp931175p931389.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message