Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

XPath queries full text search term with slash not working

Avatar

Level 1

Hi, in my project we have components with rich text including href links, I am trying to do a search to find links going to a certain locale but it appears as though the slash character causes

 

/jcr:root//*[jcr:contains(., 'en/register')] order by @jcr:score

 

This turns up results containing register but not the full string.


I am trying to make sense of the documentation https://jackrabbit.apache.org/archive/wiki/JCR/EncodingAndEscaping_115513396.html

 

"Furthermore, in XPath queries there is the full text search using "jcr:contains()" and this has its own query string format itself, which in Jackrabbit will be that of Lucene."

 

https://lucene.apache.org/core/4_7_1/queryparser/org/apache/lucene/queryparser/classic/package-summa...

 

"Lucene supports escaping special characters that are part of the query syntax. The current list special characters are

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

To escape these character use the \ before the character. For example to search for (1+1):2 use the query:

\(1\+1\)\:2"

 

However, if I do

 

/jcr:root//*[jcr:contains(., 'en\/register')] order by @jcr:score

 

It doesn't help, still turning up results that do not contain en/register. Why?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

I tried same, I can see only one results.

Can you share sample query from we-retail site so I can try.

 

Arun_Patidar_0-1584112124296.png

 



Arun Patidar

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi,

I tried same, I can see only one results.

Can you share sample query from we-retail site so I can try.

 

Arun_Patidar_0-1584112124296.png

 



Arun Patidar

Avatar

Level 1
It actually worked in a sandbox aem instance. In our work environment, tons and tons of results that do not contain en/register but only "register"

Avatar

Level 1

That is, I discovered it worked in a sandbox when trying to give this example to you. I guess nothing the forum can help with then Thanks for the answer anyway.