* Add public_reactions_count field to elasticsearch * Add new data update scripts and update old ones * Use BulkIndexWorker to batch indexing * Use proper search class for handling feed content * Remove redundant script oops * Rename data update script and remove old specs * Combine specs into one file
18 lines
446 B
Ruby
18 lines
446 B
Ruby
module Search
|
|
class BulkIndexWorker
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options queue: :high_priority, lock: :until_executing
|
|
|
|
def perform(object_class, ids)
|
|
data_hashes = object_class.constantize.
|
|
eager_load_serialized_data.
|
|
where(id: ids).
|
|
find_each.map(&:serialized_search_hash)
|
|
|
|
search_class = object_class.constantize::SEARCH_CLASS
|
|
|
|
search_class.bulk_index(data_hashes)
|
|
end
|
|
end
|
|
end
|