Skip to content

Commit add1b16

Browse files
committed
Revert "Fix needlessly indexing unsearchable statuses into ElasticSearch (mastodon#12041)"
This reverts commit 575dc11.
1 parent bc6fd06 commit add1b16

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

app/chewy/statuses_index.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ class StatusesIndex < Chewy::Index
2626
},
2727
}
2828

29-
define_type ::Status.unscoped.kept.without_reblogs.includes(:media_attachments), delete_if: ->(status) { status.searchable_by.empty? } do
29+
define_type ::Status.unscoped.without_reblogs.includes(:media_attachments) do
3030
crutch :mentions do |collection|
31-
data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id)
31+
data = ::Mention.where(status_id: collection.map(&:id)).pluck(:status_id, :account_id)
3232
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
3333
end
3434

3535
crutch :favourites do |collection|
36-
data = ::Favourite.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id)
36+
data = ::Favourite.where(status_id: collection.map(&:id)).pluck(:status_id, :account_id)
3737
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
3838
end
3939

4040
crutch :reblogs do |collection|
41-
data = ::Status.where(reblog_of_id: collection.map(&:id)).where(account: Account.local).pluck(:reblog_of_id, :account_id)
41+
data = ::Status.where(reblog_of_id: collection.map(&:id)).pluck(:reblog_of_id, :account_id)
4242
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
4343
end
4444

app/models/status.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,12 @@ class Status < ApplicationRecord
132132
REAL_TIME_WINDOW = 6.hours
133133

134134
def searchable_by(preloaded = nil)
135-
ids = []
136-
137-
ids << account_id if local?
135+
ids = [account_id]
138136

139137
if preloaded.nil?
140-
ids += mentions.where(account: Account.local).pluck(:account_id)
141-
ids += favourites.where(account: Account.local).pluck(:account_id)
142-
ids += reblogs.where(account: Account.local).pluck(:account_id)
138+
ids += mentions.pluck(:account_id)
139+
ids += favourites.pluck(:account_id)
140+
ids += reblogs.pluck(:account_id)
143141
else
144142
ids += preloaded.mentions[id] || []
145143
ids += preloaded.favourites[id] || []

0 commit comments

Comments
 (0)