1

我最近在我的 Amazon EC2 机器上安装了 SOLR,当我尝试使用 启动 SOLR 时RAILS_ENV=production bundle exec rake sunspot:solr:start --trace,我收到以下消息:

** Invoke sunspot:solr:run (first_time)
** Invoke sunspot:solr:moved_to_sunspot_solr (first_time)
** Execute sunspot:solr:moved_to_sunspot_solr

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

但是,我已经包含sunspot_solr在我的 Gemfile 中并且我的 RAILS_ENV 是生产的(我也尝试过export RAILS_ENV=production关于为什么 SOLR 无法启动并继续尝试在开发中运行的任何提示?我按照此链接安装它 - http: //tanin.nanakorn.com/b/96/tomcat_and_solr_on_ec2

这是我的 Gemfile 的一部分:

group :development, :test do
  gem 'factory_girl_rails'
  gem "rspec-rails"
  gem 'faker'
  gem 'fuubar'
  gem 'pry'
  gem 'foreman'
  gem 'guard-spork'
  gem 'sunspot_solr'
end

我已经跑过bundle install,看到 gem 正在被使用:

Using rsolr (1.0.8)
Using sunspot (1.3.0) 
Using sunspot_rails (1.3.0) 
4

1 回答 1

3

sunspot_solrgem 位于 Gemfile 的组:development中,当您指定RAILS_ENV=production. gem主要sunspot_solr是为了方便开发和测试,并没有特别针对生产进行调整,这就是文档建议将其包含在:development组中的原因。

如果您已按照链接的博客文章中描述的步骤进行操作,则实际上不需要使用 Sunspot 捆绑的 Solr 实例。在那篇文章的结尾,您应该在您的服务器上运行一个 Solr 服务器。(您必须仔细检查 Tomcat 配置以查看它在哪个端口上运行。)

如果我这么大胆,您可能还会从考虑云托管的 Solr 搜索(例如我自己的websolr.com)中受益。您应该能够在几分钟内建立并运行索引。

于 2012-12-13T23:30:14.260 回答