Fix N+1 problem on statuses/public_statuses indices

This commit is contained in:
KMY 2023-09-16 13:42:55 +09:00
parent 0ffd8acacd
commit 6aaef5c34e
2 changed files with 2 additions and 1 deletions

View file

@ -144,7 +144,7 @@ class PublicStatusesIndex < Chewy::Index
index_scope ::Status.unscoped
.kept
.indexable
.includes(:media_attachments, :preloadable_poll, :preview_cards, :tags)
.includes(:media_attachments, :preloadable_poll, :preview_cards, :tags, :account)
root date_detection: false do
field(:id, type: 'long')

View file

@ -145,6 +145,7 @@ class StatusesIndex < Chewy::Index
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: Rails.env.test? ? DEVELOPMENT_SETTINGS : PRODUCTION_SETTINGS
index_scope ::Status.unscoped.kept.without_reblogs.includes(
:account,
:media_attachments,
:preview_cards,
:local_mentioned,