lib/tasks/spotlight_tasks.rake in blacklight-spotlight-0.2.0 vs lib/tasks/spotlight_tasks.rake in blacklight-spotlight-0.3.0
- old
+ new
@@ -91,8 +91,21 @@
puts e.to_s
end
exit 1 if errors > 0
end
-end
+ end
+
+ task :reindex, [:exhibit_slug] => :environment do |_, args|
+ exhibits = if args[:exhibit_slug]
+ Spotlight::Exhibit.where(slug: args[:exhibit_slug])
+ else
+ Spotlight::Exhibit.all
+ end
+
+ exhibits.find_each do |e|
+ puts " == Reindexing #{e.title} =="
+ e.reindex_later
+ end
+ end
end