Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added separate rake task solr:optimize
  • Loading branch information
romul committed Mar 25, 2011
1 parent 2c1027f commit 561c009
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/tasks/acts_as_solr.rake
Expand Up @@ -8,3 +8,17 @@ begin
rescue LoadError
puts "WARNING: acts_as_solr_reloaded gem appears to be unavailable. Please install with bundle install."
end

namespace :solr do
task :optimize => :environment do
acts_as_solr_lib_path = $LOAD_PATH.find{|path| path =~ /acts_as_solr_reloaded/ }
require File.expand_path("#{acts_as_solr_lib_path}/../config/solr_environment")
begin
puts "Optimizing..."
Product.solr_optimize
rescue Errno::ECONNREFUSED
puts "Can't run optimizing, b/c Solr server is unavailable."
end
end
end

0 comments on commit 561c009

Please sign in to comment.