Expand my Community achievements bar.

SOLVED

What should be the query to fetch all the pages which are having a specific word or start with that word in AEM query builder ?

Avatar

Level 4

In my site i have a search bar on my UI where user can search for any specific page which starts with a letter or having that word in the page name. let suppose i have these pages "Check user details", "Check employee details", "User checkout timing details". And now user is searching with the keyword check, so it should return all the pages having word "check"

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can utilize the nodename predicate to search for pages by their name.

type = cq:Page
path = /content/aem-demo
nodename = *check*
p.limit = -1

https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/developing/platfo...  

View solution in original post

7 Replies

Avatar

Community Advisor

Hi @monish_gavali ,

In your query builder map you can use fulltext search functionality.
Something like below:

       map.put("path", "/content/<sample-path>");
     //searchText would be your variable or user input from search bar
        map.put("fulltext", searchText);
        map.put("type", "cq:Page");

 

Thanks
Tarun

Avatar

Correct answer by
Community Advisor

You can utilize the nodename predicate to search for pages by their name.

type = cq:Page
path = /content/aem-demo
nodename = *check*
p.limit = -1

https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/developing/platfo...  

Avatar

Level 4

It worked for me but what if i want to create some query in the below thing.

monish7_0-1707908886994.png

 

Avatar

Community Advisor

Equivalent XPath Query

/jcr:root/content/aem-demo//element(*, cq:Page)
[
  (jcr:like(fn:name(), '%check%')) 
]

You can refer to this link for more details.
https://experienceleague.adobe.com/docs/experience-manager-65/assets/JCR_query_cheatsheet-v1.1.pdf?l...

 

 

Avatar

Administrator

@monish_gavali Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni