Commit ae31222b by Rocky Duan

task to reindex

parent e32f8e54
......@@ -227,62 +227,12 @@ namespace :db do
puts "Time elapsed #{(end_time - beginning_time)*1000} milliseconds"
end
end
# copied from https://github.com/sunspot/sunspot/blob/master/sunspot_solr/lib/sunspot/solr/tasks.rb
namespace :sunspot do
namespace :solr do
desc 'Start the Solr instance'
task :start => :environment do
case RUBY_PLATFORM
when /w(in)?32$/, /java$/
abort("This command is not supported on #{RUBY_PLATFORM}. " +
"Use rake sunspot:solr:run to run Solr in the foreground.")
end
Sunspot::Solr::Server.new.start
puts "Successfully started Solr ..."
end
desc 'Run the Solr instance in the foreground'
task :run => :environment do
Sunspot::Solr::Server.new.run
end
desc 'Stop the Solr instance'
task :stop => :environment do
case RUBY_PLATFORM
when /w(in)?32$/, /java$/
abort("This command is not supported on #{RUBY_PLATFORM}. " +
"Use rake sunspot:solr:run to run Solr in the foreground.")
end
Sunspot::Solr::Server.new.stop
puts "Successfully stopped Solr ..."
end
desc 'Restart the Solr instance'
task :restart => :environment do
case RUBY_PLATFORM
when /w(in)?32$/, /java$/
abort("This command is not supported on #{RUBY_PLATFORM}. " +
"Use rake sunspot:solr:run to run Solr in the foreground.")
end
Sunspot::Solr::Server.new.stop
Sunspot::Solr::Server.new.start
puts "Successfully restarted Solr ..."
end
end
task :commit => :environment do
Sunspot.commit
task :reindex_search => :environment do
Tire.index('comment_threads').delete
CommentThread.create_elasticsearch_index
Tire.index('comment_threads') { import CommentThread.all }
end
end
namespace :jobs do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment