Ruby on rails 3 rails3.1.1和太阳黑子:Solr响应:未找到错误
我正在尝试使用sunspot_solr构建一个应用程序,但我一直遇到以下错误:Ruby on rails 3 rails3.1.1和太阳黑子:Solr响应:未找到错误,ruby-on-rails-3,solr,sunspot,Ruby On Rails 3,Solr,Sunspot,我正在尝试使用sunspot_solr构建一个应用程序,但我一直遇到以下错误: rsolr (0.12.1) lib/rsolr/connection/requestable.rb:39:in `request' rsolr (0.12.1) lib/rsolr/client.rb:34:in `request' sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:35:in `execute' sunspot_rails (1.2.1)
rsolr (0.12.1) lib/rsolr/connection/requestable.rb:39:in `request'
rsolr (0.12.1) lib/rsolr/client.rb:34:in `request'
sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:35:in `execute'
sunspot_rails (1.2.1) lib/sunspot/rails/searchable.rb:306:in `solr_execute_search'
sunspot_rails (1.2.1) lib/sunspot/rails/searchable.rb:139:in `solr_search'
app/controllers/search_controller.rb:7:in `results'
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <class:User> at /home/romio/hummingtown_v1/app/models/user.rb:17)
这是我的太阳黑子。yml:
solr:
hostname: localhost
port: 8980
log_level: INFO
path: /solr
pid_dir: /solr/pids/development
auto_commit_after_delete_request: true
在运行查询时,我得到了所有期望的结果。但是当我运行我的应用程序时,我得到了上面的错误
我的配置:
轨道3.1.1
太阳黑子:1.2.1
请让我知道您还需要我提供哪些信息,并提前感谢您的回答
我查看了日志文件,发现了以下错误:
rsolr (0.12.1) lib/rsolr/connection/requestable.rb:39:in `request'
rsolr (0.12.1) lib/rsolr/client.rb:34:in `request'
sunspot (1.2.1) lib/sunspot/search/abstract_search.rb:35:in `execute'
sunspot_rails (1.2.1) lib/sunspot/rails/searchable.rb:306:in `solr_execute_search'
sunspot_rails (1.2.1) lib/sunspot/rails/searchable.rb:139:in `solr_search'
app/controllers/search_controller.rb:7:in `results'
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <class:User> at /home/romio/hummingtown_v1/app/models/user.rb:17)
弃用警告:类\u可继承属性已弃用,请改用类\u属性方法。请注意,它们的行为稍有不同,因此请首先参考class_属性文档。(从at/home/romio/hummingtown_v1/app/models/user.rb:17调用)
这是我的user.rb:
require 'digest/sha2'
class User < ActiveRecord::Base
has_many :userauths, :dependent => :destroy
attr_accessor :password
attr_accessible :first_name, :last_name, :email, :password, :salt
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :first_name, :presence => true, :length => { :maximum => 50 }
validates :last_name, :presence => true, :length => { :maximum => 50 }
validates :email, :presence => true, :format => { :with => email_regex },
:uniqueness => { :case_sensitive => false }
searchable :auto_index => true, :auto_remove => true do
text :first_name, :default_boost => 2
text :last_name
text :email
end
需要“摘要/sha2”
类用户:destroy
属性访问器:密码
属性可访问:名字、姓氏、电子邮件、密码、盐
电子邮件\u regex=/\A[\w+\-.]+@[A-z\d\-.]+\[A-z]+\z/i
验证:first_name,:presence=>true,:length=>{:max=>50}
验证:last_name,:presence=>true,:length=>{:max=>50}
验证:email,:presence=>true,:format=>{:with=>email_regex},
:唯一性=>{:区分大小写=>false}
可搜索:auto_index=>true,:auto_remove=>true do
text:first\u name,:default\u boost=>2
文本:姓氏
文本:电子邮件
结束
在我将我的太阳黑子升级到1.3.0和rsolr升级到1.0.6之后,它起了作用