Class: Escargot::DistributedIndexing::ReIndexDocuments

Inherits:
Object
  • Object
show all
Defined in:
lib/escargot/distributed_indexing.rb

Class Method Summary collapse

Class Method Details

.perform(model_name, ids) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/escargot/distributed_indexing.rb', line 36

def self.perform(model_name, ids)
  model = model_name.constantize
  ids_found = []
  model.find(:all, :conditions => {:id => ids}).each do |record|
    record.local_index_in_elastic_search
    ids_found << record.id
  end

  (ids - ids_found).each do |id|
    model.delete_id_from_index(id)
  end
end