JCR SQL2 ISDESCENDANTNODE Multiple Paths Example

While working with the JCR SQL2 Queries, you may encounter scenarios where content is distributed across various branches of the repository. Querying these branches efficiently is key to implement features to capture requirements. In this article, we will focus o how to collect and query for distributed across various branches of the repository. Using the ISDESCENDANTNODE feature of the JCR SQL Query proves it possible.

Understanding ISDESCENDANTNODE

ISDESCENDANTNODE is a condition in JCR SQL2 that checks if a node is a descendant of another, based on their paths. It is particularly beneficial for querying content hierarchies. Imagine you have content in different branches (content tree) of your AEM repository. You want to search across these branches simultaneously, without running separate queries. This is where ISDESCENDANTNODE shines.

By specifying multiple paths within the ISDESCENDANTNODE condition, you can search for content across these paths concurrently, streamlining your queries. This powerful feature simplifies and optimizes the content retrieval process in AEM.


Finding all cq:Pages under 1 path
with the jcr:content/jcr:title CONTAINS %terms%

1
2
3
SELECT * FROM [cq:Page]
WHERE ISDESCENDANTNODE('/content/sourcedcode/us/')
AND CONTAINS([jcr:content/jcr:title], 'terms')

Finding all cq:Pages under 2 paths
with the jcr:content/jcr:title CONTAINS %terms%

1
2
3
4
SELECT * FROM [cq:Page]
WHERE (ISDESCENDANTNODE('/content/sourcedcode/us/')
OR ISDESCENDANTNODE('/content/sourcedcode/ca/')
AND CONTAINS([jcr:content/jcr:title], 'terms')

Finding all cq:Pages under 3 paths
with the jcr:content/jcr:title CONTAINS %terms%

1
2
3
4
5
SELECT * FROM [cq:Page]
WHERE (ISDESCENDANTNODE('/content/sourcedcode/us/')
OR ISDESCENDANTNODE('/content/sourcedcode/ca/')
OR ISDESCENDANTNODE('/content/sourcedcode/pl/'))
AND CONTAINS([jcr:content/jcr:title], 'terms')

Hello, I am an enthusiastic Adobe Community Advisor and a seasoned Lead AEM Developer. I am currently serving as an AEM Technical Lead at MNPDigital.ca, bringing over a decade of extensive web engineering experience and more than eight years of practical AEM experience to the table. My goal is to give back to the AEM Full Stack Development community by sharing my wealth of knowledge with others. You can connect with me on LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back To Top
xx1toto togel xx1 toto login xx1toto xx1toto link xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto xx1toto journalberitaterkini xx1toto xx1toto pasaran togel