Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

exclude page paths from search querybuilder

Avatar

Level 4

aem- I am trying to write a query to search all pages within specific root path but in the query we want to to pass page paths which needs to be excluded in search results. Any pointers on how to exclude specific page paths in query?

2 Replies

Avatar

Level 5

Hello rajeevy89244319

Try something like below where the first operand indicated the path for your NOT criteria, second operand is for the path you wish to query, and third operand is basically a property to query.

select * from [cq:PageContent] where (NOT isdescendantnode([/content/we-retail/ca/en]) AND isdescendantnode([/content/we-retail/])) AND [jcr:title] is not null

Best Regards,

Aneet Arora

Avatar

Level 4

Thanks aneeta45259594​. I am trying to create predicate with not condition for page path to be excluded and add that predicate to the predicate group where the page root path for search is added. I tried setNegate method but that didnot work. i will try to give a try to direct query.