Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

XPath queries full text search term with slash not working

Avatar

Avatar
Level 1
maxl45258350
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
maxl45258350
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile
maxl45258350
Level 1

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
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
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)