Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-4056

Combining NOT ISDESCENDANTNODE with AND operators does not yield the same result as with OR operators

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.8.3
    • None
    • JCR 2.0, sql
    • None
    • Ubuntu 14.04, Magnolia 5.4.7 (with Jackrabbit 2.8.0), Oracle Java 1.8.0_u66, MySQL 5.7

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andreas.doebeli Andreas Doebeli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: