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

Child axis support in order by clause does not work

    XMLWordPrintableJSON

Details

    Description

      Child axis support for order by in xpath queries was introduced with JCR-800.

      In my use case I have a cq:Page nodetype which has a jcr:content child of type cq:PageContent (like nt:file and nt:resource). The jcr:content child has a cq:lastModified time stamp that I want to search on. I use descending to see the most recently modified nodes at the top.

      The problem is that it does not work when using a child axis in the order by:

      (1) //element(*, cq:Page) order by @jcr:content/cq:lastModified descending

      This gives a different (and wrong) result compared to the simpler query on level deeper, which returns the correct results:

      (2) //element(*, cq:PageContent) order by @cq:lastModified descending

      Switching between ascending and descending in (1) does not change the result set at all, ie. the order stays the same.

      A reason could be non-existing properties (of which there are some in my data), so to only look at existing properties, I run this query, which still gives incorrect results:

      (3) //element(*, cq:Page)[jcr:content/@cq:lastModified] order by @jcr:content/cq:lastModified descending

      Attachments

        Activity

          People

            Unassigned Unassigned
            alexander.klimetschek Alexander Klimetschek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: