Rails - 安装后的Sunspot Solr 404错误

时间:2012-03-23 00:40:36

标签: ruby-on-rails search solr sunspot

我刚刚在我的rails应用程序中安装了Sunspot Solr,启动服务器后,我收到了这个错误..

Started GET "/faq/search?search=blueberry" for 143.183.25.73 at 2012-03-22 17:34:27 -0700
Processing by FaqController#search as 
Parameters: {"search"=>"blueberry"}
Keyword Load (0.8ms)  SELECT distinct(content) FROM `keywords` LIMIT 30
SOLR Request (5.2ms)  [ path=#<RSolr::Client:0x000000033c1808> parameters={data:   fq=type%3AQuestion&q=blueberry&fl=%2A+score&qf=content_text&defType=dismax&start=0&rows=30, method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, path: select, uri: http://localhost:8982/solr/select?wt=ruby, open_timeout: , read_timeout: } ]
Completed 500 Internal Server Error in 35ms

RSolr::Error::Http (RSolr::Error::Http - 404 Not Found
Error: NOT_FOUND

Request Data: "fq=type%3AQuestion&q=blueberry&fl=%2A+score&qf=content_text&defType=dismax&start=0&rows=30"

导致所有这些混乱的代码行是这样的:

# sunspot stuff
@search = Question.search do
  fulltext query
end
@questions = @search.results

有没有人看到过Solr 404错误?我确实在网上搜索了现有的solr问题,但没有发现这个问题。感谢。

1 个答案:

答案 0 :(得分:3)

我意识到这已经很老了,你可能已经解决了,但我能够通过在sunspot.yml文件中注释掉路径来解决这个问题。

它来自(失败):

production:
  solr:
    hostname: localhost
    port: 8080
    log_level: WARNING
    path: /solr/production
    # read_timeout: 2
    # open_timeout: 0.5

development:
  solr:
    hostname: 0.0.0.0
    port: 8982
    log_level: INFO
    path: /solr/development

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING
    path: /solr/test

到(工作)

production:
  solr:
    hostname: localhost
    port: 8080
    log_level: WARNING
    #path: /solr/production
    # read_timeout: 2
    # open_timeout: 0.5

development:
  solr:
    hostname: 0.0.0.0
    port: 8982
    log_level: INFO
    #path: /solr/development

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING
    #path: /solr/test