[
https://issues.apache.org/jira/browse/JCR-4056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Doebeli updated JCR-4056:
---------------------------------
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*
{code}
/
-content
-exclude1
-notSelected
-exclude2
-otherNotSelected
-include
-selected
-other
{code}
*Analysis*
The query with {{OR}} operators:
{code}
SELECT * FROM [nt:base] WHERE NOT (ISDESCENDANTNODE('/content/exclude1') OR
ISDESCENDANTNODE('/content/exclude2'))
{code}
Running this query yields 7 results:
{code}
node /
node /content/exclude1
node /content
node /content/exclude2
node /content/include
node /content/include/selected
node /content/include/other
{code}
While running the following Query returns 8 results:
{code}
SELECT * FROM [nt:base] WHERE (NOT ISDESCENDANTNODE('/content/exclude1') AND
NOT ISDESCENDANTNODE('/content/exclude2'))
{code}
Result:
{code}
node /
node /content/exclude1
node /content
node /content/exclude2/otherNotSelected
node /content/exclude2
node /content/include
node /content/include/selected
node /content/include/other
{code}
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.
was:
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*
{code}
/
-content
-exclude1
-notSelected
-exclude2
-otherNotSelected
-include
-selected
-other
{code}
*Analysis*
Runningthe query with {{OR}} operators:
{code}
SELECT * FROM [nt:base] WHERE NOT (ISDESCENDANTNODE('/content/exclude1') OR
ISDESCENDANTNODE('/content/exclude2'))
{code}
Running this query yields 7 results:
{code}
node /
node /content/exclude1
node /content
node /content/exclude2
node /content/include
node /content/include/selected
node /content/include/other
{code}
While running the following Query returns 8 results:
{code}
SELECT * FROM [nt:base] WHERE (NOT ISDESCENDANTNODE('/content/exclude1') AND
NOT ISDESCENDANTNODE('/content/exclude2'))
{code}
Result:
{code}
node /
node /content/exclude1
node /content
node /content/exclude2/otherNotSelected
node /content/exclude2
node /content/include
node /content/include/selected
node /content/include/other
{code}
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.
> Combining NOT ISDESCENDANTNODE with AND operators does not yield the same
> result as with OR operators
> -----------------------------------------------------------------------------------------------------
>
> Key: JCR-4056
> URL: https://issues.apache.org/jira/browse/JCR-4056
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: JCR 2.0, sql
> Affects Versions: 2.8.3
> Environment: Ubuntu 14.04, Magnolia 5.4.7 (with Jackrabbit 2.8.0),
> Oracle Java 1.8.0_u66, MySQL 5.7
> Reporter: Andreas Doebeli
>
> 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*
> {code}
> /
> -content
> -exclude1
> -notSelected
> -exclude2
> -otherNotSelected
> -include
> -selected
> -other
> {code}
> *Analysis*
> The query with {{OR}} operators:
> {code}
> SELECT * FROM [nt:base] WHERE NOT (ISDESCENDANTNODE('/content/exclude1') OR
> ISDESCENDANTNODE('/content/exclude2'))
> {code}
> Running this query yields 7 results:
> {code}
> node /
> node /content/exclude1
> node /content
> node /content/exclude2
> node /content/include
> node /content/include/selected
> node /content/include/other
> {code}
> While running the following Query returns 8 results:
> {code}
> SELECT * FROM [nt:base] WHERE (NOT ISDESCENDANTNODE('/content/exclude1') AND
> NOT ISDESCENDANTNODE('/content/exclude2'))
> {code}
> Result:
> {code}
> node /
> node /content/exclude1
> node /content
> node /content/exclude2/otherNotSelected
> node /content/exclude2
> node /content/include
> node /content/include/selected
> node /content/include/other
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)