PERF: Optimize search in private messages query (PR #14660)

JOIN on categories is not needed when searchin in private messages as PMs are not categorized.


The title of this pull request changed from “PERF: Remove JOIN on categories for PM search” to "PERF: Optimize search in private messages query

Do test this out with a user with a lot of group messages. The last time I optimised this, I did a left join on both tables and had an OR filter as well. However, the performance of the query degraded significantly for a user with lots of group messages.

It seems that search is especially slow for users with many group messages. This change should improve that case.