我遇到类似Solr with Rails - rake sunspot:reindex is not working的问题。
我在Gemfile中有这些:
gem 'sunspot_solr', github: 'sunspot/sunspot', branch: 'master'
gem 'sunspot_rails', github: 'sunspot/sunspot', branch: 'master'
和
bundle exec rake sunspot:solr:start
工作正常,但当我这样做时:
bundle exec rake sunspot:solr:reindex
我明白了:
Connection refused - {:data=>
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Service</query></delete>",
:headers=>{"Content-Type"=>"text/xml"}, :method=>:post, :params=>{:wt=>:ruby},
:query=>"wt=ruby", :path=>"update", :uri=>
#<URI::HTTP:0x007fccf982f348 URL:http://localhost:8982/solr/default/update?wt=ruby>,
:open_timeout=>nil, :read_timeout=>nil, :retry_503=>nil,
:retry_after_limit=>nil}
答案 0 :(得分:3)
我添加了sunspot.yml的路径
development:
solr:
hostname: localhost
port: 8982
log_level: INFO
path: /solr/development
test:
solr:
hostname: localhost
port: 8981
log_level: WARNING
path: /solr/test
不确定这是否足够好。似乎这是因为我使用的是Solr 4,配置正在创建solr/environment
类型的URL。