Fixed an ordering check that could be fooled by a nested query
The safeguard verifying how indexed content is ordered read the first ordering instruction it found, which could belong to a nested sub-query rather than the one that actually determines the result order. It now reads the instruction that governs the result, and its own logic is covered by direct tests.