Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SolrWorker
- @queue = 'solr'
- def self.perform(ids, options={})
- options.symbolize_keys!
- options.assert_valid_keys(:time_zone, :commit)
- Time.zone = options[:time_zone] if options[:time_zone]
- objects = []
- ids.each_pair do |class_name, instance_ids|
- objects.concat(class_name.constantize.find_all_by_id(instance_ids))
- end
- Sunspot.index(objects)
- Sunspot.commit if options[:commit]
- end
- end
Add Comment
Please, Sign In to add comment