【发布时间】:2013-05-12 06:56:11
【问题描述】:
产生错误:
nil:NilClass 的未定义方法 `inject'
尽管在以下位置进行了讨论: https://github.com/pat/thinking-sphinx/issues/408#issuecomment-12593562 看来我确实为基于 postgre 的应用程序正确安装了 mySQL 和 sphinx
MacBook-Pro-di-jerdvo:saim jerdvo$ brew install sphinx --mysql
错误:已安装 sphinx-2.0.3
MacBook-Pro-di-jerdvo:saim jerdvo$ brew install mysql
错误:mysql-5.5.20 已安装
gemfile 包含
宝石'导轨','3.2.13'
宝石'pg','0.14.1'
宝石'mysql2','0.3.12b5'
gem 'thinking-sphinx', '3.0.3'
正在捕获搜索参数
{"utf8"=>"✓", "staticpage_search"=>{"terms"=>"Messina"}}
搜索模型正在运行代码
def search(options = {})
extra_conditions = options.delete(:conditions) || {}
order = options.delete(:order) || '@weight DESC'
extra_with = options.delete(:with) || {}
with = search_with.merge(extra_with)
conditions = search_conditions.merge(extra_conditions)
base_class.search sanitized_terms, :conditions => conditions, :with => with, :page => page, :per_page => per_page, :sort_mode => :extended, :order => order, :retry_stale => true, :match_mode => :extended
end
def sanitized_terms
@terms ||= ""
sanitize(@terms)
end
def sanitize(s)
if s.respond_to? :gsub
s.gsub("/", "\\/")
else
s
end
end
【问题讨论】:
标签: ruby-on-rails-3.2 rvm thinking-sphinx