Querbuilder returning results for % in the keyword | Community
Skip to main content
Level 3
April 13, 2023
Solved

Querbuilder returning results for % in the keyword

  • April 13, 2023
  • 2 replies
  • 977 views

Hi All,

 

We have a requirement we need to search for results with percentage in content for example (97% off or 97%).

 

We are using ootb queryBuilder full text API for this.

But we are getting results which have 97(without %)also in the page.

What needs to be done to exclude such results from showing up in queryBuilder API.

 

We tried with both fulltext=97% and fulltext="97%"(in quotes).

 

For example we only want results which have "97%" as a whole in the page and exlude pages which have "97" in content.

 

Please find the below screenshots for reference for we-retail.

 

 

 

Page having 97 in the content

 

 

 

 

 

 

 

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 AsifChowdhury

You can read this thread: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/special-characters-search-using-querybuilder/m-p/277619/highlight/true#M43834 

There you have a complete discussion for requirement.

2 replies

nitesh_kumar-1
Adobe Employee
Adobe Employee
April 13, 2023

Hi @sb2512 ,

 

If you know the property field where you need to search then you can form your query like this

 

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([<path>]) and s.[jcr:title] like '%97%\%'

 

Hope this helps!

 

Regards,

Nitesh

Sb2512Author
Level 3
April 13, 2023

Can this be done using Query Builder API...We have search results with pagination so query builder seems to be better as it has lot more capabilities for our use case

AsifChowdhury
Community Advisor
Community Advisor
April 13, 2023

Hello @sb2512 ,

If you want to search in the content you may have to write a custom predicate for that.

You will find a similar topic has been discussed in this thread: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/special-characters-search-using-querybuilder/m-p/277605 

Thank you

Sb2512Author
Level 3
April 13, 2023

For us ,we will have full text content search not a property search.

Can writing custom predicate will restrict pages with 97 in the search results.

 

 

One Page has 97 and one page has 97%.

 

I want to restrict Page with "97" to be shown in the search results.

 

 

 

 

 

 

AsifChowdhury
Community Advisor
AsifChowdhuryCommunity AdvisorAccepted solution
Community Advisor
April 13, 2023