avim wrote:
The order of (values of) multi-valued REFERENCE properties IS maintained by
the repository(as specified in the spec).
However, jcr:deref doesn't respect that order.
It seems that it's affected by the saving order of the referenced nodes!?!
Is it a bug?
no, it's not a bug. the jcr:deref() function does not have an inherent ordering.
the final query result however has a defined order. per default the the order
of the nodes in the query result are in document order similar to XML (see:
http://www.w3.org/TR/xpath#dt-document-order). this behaviour can be disable in
the configuration of jackrabbit to achieve better query performance. then of
course you can use explicit ordering on given properties. e.g.
//element(*, nt:file) order by @jcr:created ascending
or let the implementation decide which node matched best:
//element(*, nt:file)[jcr:contains(jcr:content, 'jcr')] order by jcr:score()
descending
regards
marcel