Special Characters Search using Querybuilder | Community
Skip to main content
sai_kumart66079
August 3, 2018
Solved

Special Characters Search using Querybuilder

  • August 3, 2018
  • 17 replies
  • 12000 views

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........

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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®%

17 replies

arunpatidar
Community Advisor
Community Advisor
August 3, 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(®)?'))

]

Arun Patidar
February 2, 2021

Hi @arunpatidar ,

We're using jcr SQL2 and below mentioned is my query :

SELECT * FROM [cq:PageContent] AS s WHERE ISDESCENDANTNODE([/content/somepath]) AND (CONTAINS(s.[subtitle],"*home-page*") OR CONTAINS(s.[jcr:title],"*home-page*") OR CONTAINS(s.[jcr:description],"*home-page*"))

 

On search of text ("home-page") containing a special character, I get zero results. However, I do have 'home-page' in content nodes as per given conditions.

Could you please help me to correct my query to get results for text having a special character?

 

 

VeenaVikraman
Community Advisor
Community Advisor
August 3, 2018

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

smacdonald2008
August 3, 2018

Nice suggestion veena!

sai_kumart66079
August 6, 2018

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

VeenaVikraman
Community Advisor
Community Advisor
August 6, 2018

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

sai_kumart66079
August 6, 2018

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

arunpatidar
Community Advisor
Community Advisor
August 6, 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

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

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

Thanks

Arun

Arun Patidar
Level 3
April 13, 2023

@arunpatidar  Is there any way  for when we search for demoText® Search we get only pages which have demoText® and not demoText.

 

As right now it shows for both demoText® and demoText.

 

I need to get the pages with only demoText® when i searched for demoText®.

 

arunpatidar
Community Advisor
Community Advisor
April 14, 2023

You can try using like operator.

Arun Patidar
Techaspect_Solu
August 6, 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

sai_kumart66079
August 6, 2018

Hi Arun Patidar

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

Below without (®)?

With (®)?

Can you provide reference for JAVA API Search.

Thanks,

Sai.

arunpatidar
Community Advisor
Community Advisor
August 6, 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

Arun Patidar