EZP-23129: fixed: sort on all queries, limit on inner only
EZP-23129: adapt tests