0
0
Fork 0

Fix needlessly indexing unsearchable statuses into ElasticSearch (#12041)

This commit is contained in:
Eugen Rochko 2019-10-02 20:04:46 +02:00 committed by GitHub
parent 699f53c464
commit 575dc11cb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View file

@ -129,12 +129,14 @@ class Status < ApplicationRecord
REAL_TIME_WINDOW = 6.hours
def searchable_by(preloaded = nil)
ids = [account_id]
ids = []
ids << account_id if local?
if preloaded.nil?
ids += mentions.pluck(:account_id)
ids += favourites.pluck(:account_id)
ids += reblogs.pluck(:account_id)
ids += mentions.where(account: Account.local).pluck(:account_id)
ids += favourites.where(account: Account.local).pluck(:account_id)
ids += reblogs.where(account: Account.local).pluck(:account_id)
else
ids += preloaded.mentions[id] || []
ids += preloaded.favourites[id] || []