簡體   English   中英

rake sunspot:solr:開始拋出錯誤

[英]rake sunspot:solr:start throwing an error

我正在嘗試使用Rails 4的太陽黑子,我遇到了一些問題。 當我在gem 'sunspot_rails', '2.0.0'只有gem 'sunspot_rails', '2.0.0' ,我收到此錯誤:

Note: This task has been moved to the sunspot_solr gem. To install, start and
  stop a local Solr instance, please add sunspot_solr to your Gemfile:
  group :development do
    gem 'sunspot_solr'
 end

但是,當我添加該gem(也是v 2.0.0)時,我收到此錯誤:

rake aborted!
Don't know how to build task 'sunspot:solr:start'
/home/toasty/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
/home/toasty/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

我已經看到了這個問題: 太陽黑子/ Solr raketasks沒有在Rails 3可安裝引擎中加載,但它似乎在我的情況下不起作用。 有沒有人有任何想法? sunspot_solr與rails 4不兼容嗎?

我有同樣的問題。 我不記得了,但我發現你需要添加這個rake任務

lib/tasks/solr.rake

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

  if defined?(Sunspot::Rails::Server)
    Sunspot::Rails::Server.new.start
  else
    Sunspot::Solr::Server.new.start
  end
  puts "Successfully started Solr ..."
end

desc 'Run the Solr instance in the foreground'
task :run => :environment do
  if defined?(Sunspot::Rails::Server)
    Sunspot::Rails::Server.new.run
  else
    Sunspot::Solr::Server.new.run
  end
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

  if defined?(Sunspot::Rails::Server)
    Sunspot::Rails::Server.new.stop
  else
    Sunspot::Solr::Server.new.stop
  end
  puts "Successfully stopped Solr ..."
end

# for backwards compatibility
task :reindex => :"sunspot:reindex"
end
end

編輯~ Rakefile的來源

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM