我嘗試使用thinking_sphinx gem在我的mysql數據庫中進行搜索。但我有一些麻煩:Rails sphinx搜索未定義的方法`stringify_keys!'
我得到的錯誤:
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
(另外,我有非標準分貝,場大寫)
的Gemfile:
gem 'thinking-sphinx'
gem 'mysql2'
爲什麼會出現這個錯誤?
而且當我嘗試:
1.9.3-p429 :003 > Article.search(ART_ARTICLE_NR: "diesel")
我得到:
Killed
我有獅身人面像2.0.4。
您是否也使用MetaSearch gem? –
@IlyaKhokhryakov不,只是在gemfile中 – brabertaser19