Expand my Community achievements bar.

SQL2 - Query for nodes without specific child node

Avatar

Level 3

AEM 6.2...

I would like to identify nodes in the DAM which may have been missed by a disabled DAM Update Asset workflow.  These nodes would be missing a child metadata and/or renditions.

Executing the following two queries returns identical results:

1) SELECT * FROM [dam:Asset] AS s WHERE ISDESCENDANTNODE([/content/dam/])

2) SELECT * FROM [dam:Asset] AS s WHERE ISDESCENDANTNODE([/content/dam/]) and [jcr:content/metadata] is null

The null check does not appear to be respected.

The following query returns the inverse of what I would like to see.  It returns only nodes which DO have a metadata child node:

SELECT parent.* 
FROM [dam:Asset] as parent 
INNER JOIN  [nt:unstructured] AS child ON ISDESCENDANTNODE(child,parent) 
WHERE ISDESCENDANTNODE(child,[/content/dam]) and name(child) = 'metadata'

I can achieve this with some java code... but I'd like to understand why this query does not work as expected.

0 Replies