XPath queries full text search term with slash not working

Avatar

Avatar

maxl45258350

Avatar

maxl45258350

maxl45258350

13-03-2020

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

879
Arun_Patidar
MVP

13-03-2020

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

 

Answers (0)