Sha256: a4e823c1ae24f677fdc7d9f126ac0bf030ffa34c5684f9de1f7ab8287607825a
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
namespace :sunspot do namespace :solr do desc 'Start the Solr instance' task :start => :environment do if RUBY_PLATFORM =~ /w(in)?32$/ abort('This command does not work on Windows. Please use rake sunspot:solr:run to run Solr in the foreground.') end Sunspot::Rails::Server.new.start end desc 'Run the Solr instance in the foreground' task :run => :environment do Sunspot::Rails::Server.new.run end desc 'Stop the Solr instance' task :stop => :environment do if RUBY_PLATFORM =~ /w(in)?32$/ abort('This command does not work on Windows.') end Sunspot::Rails::Server.new.stop end task :reindex => :"sunspot:reindex" end desc 'Reindex all solr models' task :reindex => :environment do all_files = Dir.glob(File.join(RAILS_ROOT, 'app', 'models', '*.rb')) all_models = all_files.map { |path| File.basename(path, '.rb').camelize.constantize } sunspot_models = all_models.select { |m| m < ActiveRecord::Base and m.solr_searchable? } sunspot_models.each do |model| model.solr_reindex :batch_commit => false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sunspot_rails-1.0.2 | lib/sunspot/rails/tasks.rb |