我尝试使用thinking_sphinx gem 在我的mysql 数据库中进行搜索。但是我遇到了一些麻烦:
我得到错误:
1.9.3-p429 :002 > Article.search "diesel"
**NoMethodError: undefined method `stringify_keys!' for "diesel":String**
from /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/meta_search-1.1.3/lib/meta_search/builder.rb:86:in `build'
from /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/meta_search-1.1.3/lib/meta_search/searches/active_record.rb:43:in `metasearch'
from (irb):2
from /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我究竟做错了什么?
我的app/indices/article_index.rb
:
ThinkingSphinx::Index.define :article, :with => :active_record do
indexes :ART_ARTICLE_NR
end
(另外,我有非标准数据库,字段是大写的)
宝石文件:
gem 'thinking-sphinx'
gem 'mysql2'
为什么我会收到此错误?
当我尝试时:
1.9.3-p429 :003 > Article.search(ART_ARTICLE_NR: "diesel")
我得到:
Killed
我有狮身人面像 2.0.4。