Optimize Articles::Suggest query (#13548)

This commit is contained in:
Jamie Gaskins 2021-04-27 14:30:06 -04:00 committed by GitHub
parent f48cf141a6
commit d8f7518e5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,7 +46,9 @@ module Articles
end
def suggestions_by_tag(max: MAX_DEFAULT)
Article.published.tagged_with(cached_tag_list_array, any: true)
Article
.published
.cached_tagged_with_any(cached_tag_list_array)
.where.not(user_id: article.user_id)
.where(tag_suggestion_query)
.order(hotness_score: :desc)