XWIKI-9309: Also search in attachments when type is DOCUMENT
* Fix test failure due to nondeterministic order.

(cherry picked from commit 56a9fbc45433b192c1edc8739f5b4b2d16173051)