【发布时间】:2013-12-16 17:40:24
【问题描述】:
我正在将我的应用程序升级到 Rails 4,现在有了我的 rails 服务器,以及 sunspot solr,经过大量修改后,我可以访问 Solr 管理页面。但是,当我尝试从我的 rails 开发应用程序访问 solr 进行搜索或索引时,我收到以下错误
RSolr::Error::Http (RSolr::Error::Http - 404 Not Found
Error: Not Found
Request Data: "fq=type%3AMatch&fq=date_in_utc_d%3A%7B2013%5C-11%5C-29T21%5C%3A00%5C%3A00Z+TO+%2A%7D&fq=approval__s%3AAPPROVED&sort=date_d+asc&q=london&fl=%2A+score&qf=caption_text%5E10+city_name_text%5E10+team_name_text%5E10+&defType=edismax&start=0&rows=30"
Backtrace: /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot_rails-2.1.0/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.1/lib/active_support/notifications.rb:159:in `block in instrument'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.1/lib/active_support/notifications.rb:159:in `instrument'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot_rails-2.1.0/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot-2.1.0/lib/sunspot/search/abstract_search.rb:45:in `execute'
/Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot-2.1.0/lib/sunspot/session.rb:59:in `search'):
<a href="txmt://open?url=file:///Users/bashar/rails-projects/myapp/app/models/match.rb&line=474&column=1">app/models/match.rb:474:in `upcoming_games'</a>
<a href="txmt://open?url=file:///Users/bashar/rails-projects/myapp/app/controllers/tickets_controller.rb&line=34&column=1">app/controllers/tickets_controller.rb:34:in `search'</a>
Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.4ms)
Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (17.3ms)
这是 sunspot.yml 文件。
production:
solr:
hostname: ENV['WEBSOLR_URL']
port: 80
log_level: WARNING
path: /solr/production
# read_timeout: 2
# open_timeout: 0.5
development:
solr:
hostname: 192.168.0.11
port: 8981
log_level: INFO
path: /solr/development
test:
solr:
hostname: localhost
port: 8981
log_level: WARNING
path: /solr/test
我验证了 solr 是数据在正确的路径。我知道有类似的帖子,但他们的解决方案不起作用。我尝试评论path:,或者使用/solr/default,或者只使用/solr,或者使用ip而不是localhost都无济于事
有什么想法吗?关于如何查看 rails suntspot solr 请求试图到达的位置的提示?
【问题讨论】:
-
我以前在升级版本和不同步时看到过这种情况。尝试从 sunspot.yml 中删除路径选项。您总是可以在错误行打开 gem,然后调试它。
-
我也有同样的问题。到目前为止没有任何效果。
-
@sevenseacat 我已经尝试删除路径但没有运气。看起来是调试模式。
-
@climber247 只是为了确保我们遇到同样的问题,我的 sunspot-solr-development.log 文件没有错误。在升级到 Solr 1.4 期间,您需要更新一些配置文件。
-
有警告但没有错误。你的解决方案对我不起作用。 :(
标签: ruby-on-rails ruby-on-rails-4 sunspot sunspot-rails sunspot-solr