Neill Magill a8d9b17b4b MDL-63983 messaging: Improve the performance of non-contact searches
When the messagingallusers setting is disabled only contacts that are
on the same course as the user should be returned as results.

We can reduce the number of candidate users significantly by
pre-filtering them by being enrolled on the same courses as the user
performing the search.

Since we must also return the user themselves sometimes, even when they
are not enrolled on a course I used a UNION as the most efficient way of
retriving them, this meant that the order by had to reference returned
columns by number to be sufficiently cross-database compatiable.
2021-10-28 10:56:38 +01:00
..