JCR-SQL2 query result does not respect document order

13 views
Skip to first unread message

jim-zhai

unread,
Dec 19, 2017, 11:10:43 PM12/19/17
to user...@magnolia-cms.com
Hi Everyone,

During my learning of Magnolia I've encountered the issue that is my jcr-sql2 query result is not in the same order as I see in the repository browser. Any advice on how to fix this issue is much appreciated.

I am using a separate workspace, and am putting mgnl:skiContent nodes under mgnl:folder. here's the mgnl:skiContent definition:

[code]<nodeTypes
xmlns:rep="internal"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
xmlns:mgnl="http://www.magnolia.info/jcr/mgnl"
xmlns:jcr="http://www.jcp.org/jcr/1.0">
<nodeType name="mgnl:skiContent" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>mgnl:content</supertype>
</supertypes>
</nodeType>
</nodeTypes>[/code]

I googled around and found some content about this topic, for example this:

https://forums.magnolia-cms.com/forum/thread.html?threadId=9e6cbfa9-453e-478f-a640-b532d130ca35

I have checked the respectDocumentOrder property in repository/workspace.xml and it is set to true. Rebuilding index works temporarily, but if I change the order of the nodes a couple of times it'll start to appear disordered again.

Richard Unger

unread,
Dec 19, 2017, 11:10:44 PM12/19/17
to user...@magnolia-cms.com
Hi,

Does the problem also exist with an XPath query?

Regards from Vienna,

Richard

jim-zhai

unread,
Dec 19, 2017, 11:10:45 PM12/19/17
to user...@magnolia-cms.com
Hi Richard,

Thx for your reply. I didn't try it myself. Based what I found on the internet XPath and SQL1 should be fine. I'm not familiar with XPath queries so I tried SQL1 only and it works fine. Problem is, at some point we would want to utilize the joined query, which is not supported by SQL1 (and I don't think XPath can do it either) so I can't quite switch away from SQL2.

Richard Unger

unread,
Dec 19, 2017, 11:10:46 PM12/19/17
to user...@magnolia-cms.com
Hi,

Yes, we have come across this bug also - I assume this is a problem in Jackrabbit, and can't be solved in Magnolia itself. Perhaps someone at Magnolia can confirm?

For us we solved our problem by using XPath instead, but if that isn't an option for you due to missing features in XPath, perhaps JQDOM is option? Does it work as expected there?

Regards from Vienna,

Richard

jim-zhai

unread,
Dec 19, 2017, 11:10:47 PM12/19/17
to user...@magnolia-cms.com
I assume you meant JQOM? IIRC I saw a line in jackrabbit documents that says SQL2 will be translated into JQOM anyway, there's no benefit whatsoever in using JQOM directly. Although I will give it a try. Thx a lot for the advices.

jch-robert

unread,
Dec 19, 2017, 11:10:49 PM12/19/17
to user...@magnolia-cms.com
Hi,

I have the same problem and confirm the Jackrabbit issue with SQL2
I also have the "respectDocumentOrder" value set to true, and after re-indexing my workspace, it worked well, but just once! By moving the nodes again the query still returns another order (seems to be creationDate by default?).

The only way to get the nodes sorted like in jcr is to use a SQL or Xpath query, which are unfortunately deprecated
Reply all
Reply to author
Forward
0 new messages