Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

xpath query and special characers

Avatar

Level 3

I try to nodes with property that contains some text with special character like ? + and !

I have 4 nodes

/tmp/exclamation[@prop="value with!"]
/tmp/plus[@prop="value with+"]
/tmp/question[@prop="value with?"]
/tmp/string[@prop="value with string"]

/jcr:root/tmp//*[(jcr:contains(@prop, 'with') )] return me all 4 nodes
/jcr:root/tmp//*[(jcr:contains(@prop, 'with\!') )] return me all 4 nodes
/jcr:root/tmp//*[(jcr:contains(@prop, 'with\?') )] return me all 4 nodes
/jcr:root/tmp//*[(jcr:contains(@prop, 'with\+') )] return me all 4 nodes

How I should correctly escape ! + ? to get only node that mach my search criteria?

1 Accepted Solution

Avatar

Correct answer by
Level 10

The default analyzer used in CQ does not index special characters, and just create separate tokens in Lucene for words containing them. Use different LuceneAnalyzers per your need for your property & verify. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

The default analyzer used in CQ does not index special characters, and just create separate tokens in Lucene for words containing them. Use different LuceneAnalyzers per your need for your property & verify.