Skip to content

Instantly share code, notes, and snippets.

@nz
nz / 01 sample reindexing.rb
Created August 16, 2011 17:37
Custom reindexing with Sunspot
# 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 => 100) do |articles|
articles.each do |article|
tries = 0
begin
article.solr_index
rescue RSolr::RequestError => e