Querbuilder returning results for % in the keyword | Community
Skip to main content
Level 3
Apr 13, 2023 8:30 AM UTC
Solved

Querbuilder returning results for % in the keyword

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.
AsifChowdhury
AsifChowdhuryAccepted solution
New Participant
Apr 13, 2023 11:59 AM UTC

5 replies

AsifChowdhury
New Participant
Apr 13, 2023 9:23 AM UTC

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

Translate
Sb2512Author
Level 3
Apr 13, 2023 11:48 AM UTC

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.

 

 

 

 

 

 

Translate
AsifChowdhury
AsifChowdhuryAccepted solution
New Participant
Apr 13, 2023 11:59 AM UTC
nitesh_kumar-1
Employee
Apr 13, 2023 9:23 AM UTC

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

Translate
Sb2512Author
Level 3
Apr 13, 2023 11:45 AM UTC

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

Translate