Special Characters Search using Querybuilder

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

02-08-2018

Hi All,

I have a query regarding the search in JCR:content,

1. In the AEM using QueryBuilder. When I try searching with keyword "

KalmKap®" the trademark symbols are not getting searched. Instead of that it is searching for the keyword "Kalmkap".

2. The special characters like "[", "]", "{", "}", and many..... my search is not working...

Below is my Query::

group.1_fulltext.relPath=jcr:content/@jcr:title

group.1_fulltext=[KalmKap]

group.1_fulltext.relPath=jcr:content/@jcr:title

group.1_fulltext=KalmKap®

kindly help me out on this........

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

20-08-2018

If you want to do this only with QueryBuilder then create custom predicate

e.g.

Code:

aem63app-repo/CaseInsensitiveLikePredicate.java at master · arunpatidar02/aem63app-repo · GitHub

Query

path=/content/we-retail/us/en/products

caseinsensitive.property=jcr:content/@jcr:title

caseinsensitive.value=%portland®%

Screen Shot 2018-08-20 at 8.21.57 PM.png

Answers (16)

Answers (16)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

03-08-2018

Hi,

I am not sure if this is the bug or design issue. But you can try same with SQL2 or QueryBuilder API.

In XPATH you can run like below:

/jcr:root/content/AEM63App/en//*

[

(jcr:contains(., 'KalmKap(®)?'))

]

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

21-08-2018

Hi,

JCR XPATH only support few function, If you want better control over searching and querying the JCR, then use the JCR API SQL2 or the Query Builder

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

21-08-2018

Thanks Arun Patidar​ The above worked well... I'm able to fetch all the expected results....

Still I'm stuck at one point. How can I limit the search result in XPath, like "guessTotal" in queryBuilder.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

20-08-2018

Nice suggestion and a correct answer

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

20-08-2018

Hi,

fn:lower-case is not supported anymore with QueryBuilder.

Though you can use same with Xpath like below.

/jcr:root/content/we-retail/us/en/products//element(*, cq:Page)

[

(jcr:like(fn:lower-case(jcr:content/@jcr:title), '%portland®%'))

]

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

20-08-2018

Hi Arun,

Using like operator is case sensitive. Please provide any suggestion to make it case insensitive. I tried using

property=fn:lower-case(jcr:content/@jcr:title)

property.value=%kalmkap®%

property.operation=like

but it didn't generate the X-Path in query debugger and no results found.

Any suggestions for using query builder.

cc: Techaspect Solutions

Thanks,

Sai Kumar.

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

06-08-2018

Thanks Techaspect Solutions​, Arun Patidar​...

Using like operator it is working as expected.

Thanks,

Sai.

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

06-08-2018

Hi,

Can you try above query suggested by

/jcr:root/content/we-retail/us/en/products//element(*, cq:Page)

[

(jcr:like(jcr:content/@jcr:title, '%Portland®%'))
]

For Java you can either use QueryBuilderAPI or SQL2 queries.

9 JCR-SQL2 Queries Every AEM Developer Should Know - Blog - 6D Global

https://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html

http://drfits.com/jcr-sql2-query-with-examples/

Thanks

Arun

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

06-08-2018

Hi Arun Patidar

I tried your method, still i'm not getting expected results..

Below without (®)?

1543139_pastedImage_1.png

With (®)?

1543140_pastedImage_2.png

Can you provide reference for JAVA API Search.

Thanks,

Sai.

Avatar

Avatar
Boost 50
Level 6
Techaspect_Solu
Level 6

Likes

63 likes

Total Posts

150 posts

Correct reply

79 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Level 6
Techaspect_Solu
Level 6

Likes

63 likes

Total Posts

150 posts

Correct reply

79 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Techaspect_Solu
Level 6

06-08-2018

Hi,

We could achieve your requirement by using the below query. We'd suggest you to give it a try and check if it works.

For trying the below query, go to "/content/we-retail/ca/en/men" and change jcr:title property in title component to "Featured products ®". Then hit the following query from http://localhost:4502/libs/cq/search/content/querydebug.html

path=/content/we-retail/ca/en/men

property=jcr:title

property.operation=like

property.value=%®%

p.limit=-1

You should see the result now.

Hope this helps!

Regards,

TechAspect Solutions

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,441 likes

Total Posts

3,313 posts

Correct reply

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

06-08-2018

Hi Sai,

I gave try for XPATH query again,

works for me.

1. Result with query which you were trying; gives result for both demoText® and demoText

Screen Shot 2018-08-06 at 3.16.17 PM.png

2. Result with below query gives only result which contains at least one ®

Screen Shot 2018-08-06 at 3.16.29 PM.png

If you are not able to get the desire results you can try JAVA API for Search.

Thanks

Arun

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

06-08-2018

Tried with Arun's solution... But that didn't work.Arun Patidar

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

06-08-2018

Ohk. Will check on this and tell you . Did you try Arun's solution ?

Avatar

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
sai_kumart66079
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
sai_kumart66079
Level 1

06-08-2018

No that didn't work.... still my results are KalmKap.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

03-08-2018

Nice suggestion veena!

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

03-08-2018

I think you should save the text using hex code for ® symbol. It will be ® .