PERF: Use different column for better query plan (PR #14748)

Using provides a better query plan than posts.topic_id which speeds up search by almost 50%.


This feels a little off because this change assumes that we’ve already joined on the topics table before applying the scope. If I call Post.private_posts_for_user, I think this will blow up?

Yes, it will. At this moment is only used in search.rb anyway, where that is already the case.

Hmm maybe we should leave a comment here so that people know this is currently used for search only and that is why we join on the topics table instead of just using the topic_id column