Highlighted

exclude page paths from search querybuilder

Avatar

Avatar

rajeevy89244319

Avatar

rajeevy89244319

rajeevy89244319

06-10-2018

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?

Replies

Highlighted

Avatar

Avatar

aneeta45259594

Avatar

aneeta45259594

aneeta45259594

08-10-2018

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

Highlighted

Avatar

Avatar

rajeevy89244319

Avatar

rajeevy89244319

rajeevy89244319

08-10-2018

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.