【发布时间】:2012-04-07 15:01:07
【问题描述】:
我刚刚在我的 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 问题,但没有找到这个问题。谢谢。
【问题讨论】:
-
原谅我这么问,但是你开始使用 solr 了吗?
bundle exec sunspot-solr start -p 8983 -
是的,它肯定在运行..我可以看到进程在旋转。我从 -p 8982 开始,因为在我的 sphinx.yml 文件中,我的开发端口指向 8982。
-
sphinx.yml 是拼写错误还是您想针对 sphinx 运行 sunspot? :>
-
对不起,这是一个错字,意思是 sunspot.yml。我正在使用 Sphinx,现在正在使用 solr。您是否认为可能存在冲突,因为我只是通过在 gemfile 中注释掉 sphinx 来删除它?另外,当我在 solr 中运行测试搜索时,我看到了这个.. bash-4.1$ rails c 加载开发环境(Rails 3.0.9) ruby-1.9.2-p290 :001 > Question.search { fulltext 'omar' } RSolr::Error::Http: RSolr::Error::Http - 404 未找到错误:NOT_FOUND 请求数据:“fq=type%3AQuestion&q=omar&fl=%2A+score&qf=content_text&defType=dismax&start=0&rows=30”
标签: ruby-on-rails search solr sunspot