Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Query Builder escaping

Avatar

Level 3

I just notice that Query builder escapes special characters in values but only first one.

in debug log in XPath I see values:

'Start Off on the Left Foot\!'  - when query for text with !

'Moving to Alabama\?'  - when query for text with ?

But when query for test with ? and !

'Moving to Alabama? Start Off on the Left Foot\!' or 'Moving to Alabama! Start Off on the Left Foot\?'

1 Accepted Solution

Avatar

Correct answer by
Level 10

bartek_r wrote...

AEM 5.6.1.20130606
com.day.cq.cq-search 5.6.4

I also test Text.escapeIllegalXpathSearchChars from jackrabbit-jcr-commons 2.6.2 - 2.8 and it behave exactly same

 

I could not reproduce the issue. Do you have any custom index configuration done?

View solution in original post

4 Replies

Avatar

Level 10

which version of aem?  What is bundle version of com.day.cq.cq-search?

Avatar

Level 3

AEM 5.6.1.20130606
com.day.cq.cq-search 5.6.4

I also test Text.escapeIllegalXpathSearchChars from jackrabbit-jcr-commons 2.6.2 - 2.8 and it behave exactly same

Avatar

Correct answer by
Level 10

bartek_r wrote...

AEM 5.6.1.20130606
com.day.cq.cq-search 5.6.4

I also test Text.escapeIllegalXpathSearchChars from jackrabbit-jcr-commons 2.6.2 - 2.8 and it behave exactly same

 

I could not reproduce the issue. Do you have any custom index configuration done?

Avatar

Level 3

I just write script in groovy to escape text and print it out, it is not about index but escaping characters before it go to search.

import org.apache.jackrabbit.util.Text fullText = "Moving to Alabama? Start Off on the Left Foot!"; println Text.escapeIllegalXpathSearchChars(fullText); // Moving to Alabama? Start Off on the Left Foot\! fullText = "Moving to Alabama! Start Off on the Left Foot!"; println Text.escapeIllegalXpathSearchChars(fullText); // Moving to Alabama! Start Off on the Left Foot\! fullText = "Moving to Alabama! Start Off on the Left Foot?"; println Text.escapeIllegalXpathSearchChars(fullText); // Moving to Alabama! Start Off on the Left Foot\?