Details
Description
I noticed that using NOT ISDESCENDANTNODE used with AND operators does not yield the same result as when using OR operators.
General assumption
(!A && !B) == !(A || B)
Test Structure in JCR
/ -content -exclude1 -notSelected -exclude2 -otherNotSelected -include -selected -other
Analysis
The query with OR operators:
SELECT * FROM [nt:base] WHERE NOT (ISDESCENDANTNODE('/content/exclude1') OR ISDESCENDANTNODE('/content/exclude2'))
Running this query yields 7 results:
node / node /content/exclude1 node /content node /content/exclude2 node /content/include node /content/include/selected node /content/include/other
While running the following Query returns 8 results:
SELECT * FROM [nt:base] WHERE (NOT ISDESCENDANTNODE('/content/exclude1') AND NOT ISDESCENDANTNODE('/content/exclude2'))
Result:
node / node /content/exclude1 node /content node /content/exclude2/otherNotSelected node /content/exclude2 node /content/include node /content/include/selected node /content/include/other
It seems that combining NOT ISDESCENDANTNODE with AND operators the second NOT ISDESCENDANTNODE check is ignored.
IMHO logical operations should work as expected. If using NOT ISDESCENDANTNODE with AND operators is not supported, it should exit with an error instead of silently behaving unexpectedly.