I would expect the returned nodes to be ordered by index. But this is not the case, nodes with higher index might be returned first, depending on the order of the instanceof filters.
A sorted behavior based on the index is imo rather expected, as its the default behavior for an unfiltered children query and the nodes show up in this order in the ui.
The ordering works, because the children operation asks the nodeData repository which internally filters the nodes by index:
This sorting is not leveraged by children as we actually iterate one by one over the filters and query the nodeData repository again and again and merge their output:
... when using multiple instance of filters:
I would expect the returned nodes to be ordered by index. But this is not the case, nodes with higher index might be returned first, depending on the order of the
instanceof
filters.A sorted behavior based on the index is imo rather expected, as its the default behavior for an unfiltered children query and the nodes show up in this order in the ui. The ordering works, because the
children
operation asks the nodeData repository which internally filters the nodes by index:https://github.com/neos/neos-development-collection/blob/072186e1601d82a8565942a05c9fe7253cf7f85d/Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php#L884-L903
This sorting is not leveraged by
children
as we actually iterate one by one over the filters and query the nodeData repository again and again and merge their output:https://github.com/neos/neos-development-collection/blob/928cc4aa5b427b84cf18ae2af8578e916d0d3afb/Neos.ContentRepository/Classes/Eel/FlowQueryOperations/ChildrenOperation.php#L112
so this flowquery:
actually doesnt translate to this expected optimized code (fewer sql queries)
but rather in several calls, which outputs will be merged (but not sorted)
(im using here
nodeDataRepository
in the example, you might be more familiar with the alias->getChildNodes
oder->findChildNodes
)This is an issue with Neos ? ... 7.3 ... 8.3 and possibly also Neos 9