Rails 4:RSolr :: Error :: Http(RSolr :: Error :: Http-404未找到 [英] Rails 4: RSolr::Error::Http (RSolr::Error::Http - 404 Not Found

查看:112
本文介绍了Rails 4:RSolr :: Error :: Http(RSolr :: Error :: Http-404未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的应用程序升级到Rails 4,现在已经安装了我的Rails服务器以及黑子solr,经过大量修改后可以运行,我可以访问Solr管理员页面.但是,当我尝试从Rails开发应用程序访问solr进行搜索或索引时,出现以下错误

I am in the process of upgrading my app to Rails 4, and now got my rails server, as well as sunspot solr, after a lot of tinkering, to run, I can access Solr admin page. However when I try to access solr from my rails development app to do search or index, I get the following error

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&amp;line=474&amp;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&amp;line=34&amp;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是数据在正确的路径中.我知道也有类似的帖子,但是他们的解决方案没有用.我试图注释路径:,或使用/solr/default,或仅使用/solr,或使用ip而不是localhost无效

I verified solr is data is in the right path. I know there are similar posts, but their solutions didn't work. I tried to comment path:, or use /solr/default, or just /solr, or use the ip instead of localhost to no avail

有什么主意吗?有关如何查看rails suntspot solr请求试图到达的位置的提示?

Any idea? Tips on how I can see where the rails suntspot solr request is trying to reach?

推荐答案

解决了!回答中的步骤在这里建议,几乎没有改动:

Solved it! Followed steps in Answer suggested here with little alteration:

  1. 停止所有正在运行的solr进程
  2. 删除solr文件夹但如果需要一些旧的配置,同义词等,请保留该副本以供访问.
  3. gem卸载所有相关的宝石
  4. 捆绑安装
  5. rails生成sunspot_rails:install
  6. 启动solr
  7. reindex solr:现在,当我使用蒙古包时,rake sunspot:reindex似乎不起作用,但是从控制台上执行Sunspot.index!(Model.all)正为我做这件事.
  1. stopping all running solr processes
  2. removing the solr folder BUT keep a copy of it accessible in case you need some of the old config, synonyms and such.
  3. gem uninstall all related gems
  4. bundle install
  5. rails generate sunspot_rails:install
  6. start solr
  7. reindex solr: Now as I'm using mongoid, rake sunspot:reindex doesn't seem to work, but going from console and doing Sunspot.index!(Model.all) is doing it for me.

这篇关于Rails 4:RSolr :: Error :: Http(RSolr :: Error :: Http-404未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆