Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Custom reindexing with Sunspot
- # Use your own finder, rescue and log exceptions, etc.
- # Throw this in a rake task, or class method to run from the console
- Article.find_in_batches(:batch_size => 10) do |articles|
- articles.each do |article|
- tries = 0
- begin
- article.solr_index
- rescue RSolr::RequestError => e
- puts "ERROR - #{e.message} on #{article.inspect}"
- if (tries += 1) < 3
- sleep 2 ** tries
- retry
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment