Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

exclude page paths from search querybuilder

rajeevy89244319
Level 3
Level 3

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?

0 Replies
aneeta45259594
Level 5
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

rajeevy89244319
Level 3
Level 3

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.