Hi,

currently it is not possible to sort query results by document order
if respectDocumentOrder is left at the default of false in the workspace
configuration.
The need to support such sorting per query was discussed years back when
the default setting was changed to false in JCR-1237 (and postponed at the
time).

For applications that occasionally require sorting by document order,
setting respectDocumentOrder to true bears a huge performance impact, as
results are sorted in-memory.
An (ugly) workaround for such applications is to set respectDocumentOrder
to true and use "order by @jcr:score" on queries where order does not
matter (which is faster), but even disregarding its ugliness, this does not
work for mixed-scope applications (e.g. a specific project built on top of
Sling which would need to touch Sling code to implement this workaround).

In that light, would it make sense to support something along the lines of
- order by @jcr:none (to explicitly request disregarding document order for
installations where respectDocumentOrder is true
and/or
- order by @jcr:documentOrder (to explicity request ordering by
documentOrder for installations where respectDocumentOrder is false

(I guess the jcr namespace is not appropriate?)

The second one can proably boast a much larger number of use cases (I have
encountered two use cases in the last 2 days that would be covered by the
second case)

Cheers
Ben

Reply via email to