Skip to content

Instantly share code, notes, and snippets.

@orbanbotond
Created October 17, 2012 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orbanbotond/3906179 to your computer and use it in GitHub Desktop.
Save orbanbotond/3906179 to your computer and use it in GitHub Desktop.
item removal
sale = Sale.new
Item.where("brand LIKE '%Barney%'").where(:deleted_at => nil).each do |item|
doc1 = AWSCloudSearch::Document.new(true)
doc1.id = item.id
sale.destroy_doc(doc1)
item.deleted_at = Time.now
item.save
end
sale.flush_batch
sale = Sale.new
Item.where("shop LIKE '%Barney%'").where(:deleted_at => nil).each do |item|
doc1 = AWSCloudSearch::Document.new(true)
doc1.id = item.id
sale.destroy_doc(doc1)
item.deleted_at = Time.now
item.save
end
sale.flush_batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment