Don't use Current.account for search records
It doesn't actually work, and even if we could make it work reliably we are better off if the records always know to go to the right shard. It does make the interface a bit more complicated as we need to select the right shard class with `for(account_id)`.
This commit is contained in:
@@ -12,16 +12,10 @@ namespace :search do
|
||||
end
|
||||
|
||||
puts "Reindexing cards..."
|
||||
Card.find_each do |card|
|
||||
Current.account = card.account
|
||||
card.reindex
|
||||
end
|
||||
Card.includes(:rich_text_description).find_each(&:reindex)
|
||||
|
||||
puts "Reindexing comments..."
|
||||
Comment.find_each do |comment|
|
||||
Current.account = comment.account
|
||||
comment.reindex
|
||||
end
|
||||
Comment.includes(:rich_text_body, :card).find_each(&:reindex)
|
||||
|
||||
puts "Done! Reindexed #{Card.count} cards and #{Comment.count} comments."
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user