Query Builder escaping | Community
Skip to main content
broman__pl
Level 3
October 16, 2015
Solved

Query Builder escaping

  • October 16, 2015
  • 4 replies
  • 2067 views

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\?'

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

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?

4 replies

Sham_HC
Level 10
October 16, 2015

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

broman__pl
Level 3
October 16, 2015

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

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

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?

broman__pl
Level 3
October 16, 2015

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\?