Hello Roy
XPath queries allow ordering by a property:
/jcr:root/A//element(*, nt:unstructured) [
jcr:contains(property, ‘value’)
] order by @otherProperty descending
If you want the child order, you should iterate over the child node
using the API:
NodeIterator children = session.getNode("/A").getNodes();
while (children.hasNext()) {
Node child = children.nextNode();
// do something with it
}
In other words: query results don't know about the sibling order of nodes.
Regards
Julian
On Wed, Mar 2, 2016 at 7:13 PM, Roy Teeuwen <[email protected]> wrote:
> Hello all,
>
> I have a node A with subnodes B,C,D and am creating a JCR query to retrieve
> some of the subnodes by using the following XPATH query:
>
> /jcr:root/A//element(*, nt:unstructured) [
> jcr:contains(property, ‘value’)
> ]
>
> The problem that I am facing at this moment that the order it retrieves the
> elements seem te be random. Sometimes it gives back B,D and sometimes D,B.
> What I would like is that it always gives back the order that the nodes have
> below A has in the jcr repository, is it possible to pass this to the query
> (either XPath or an SQL for the same result)
>
> Thanks
> Roy