Wednesday 15 August 2012

ruby - Rails sphinx search undefined method `stringify_keys!' -


I try to search my mysql database using my_sphinx gem. But I have some problems:

I get an error:

  1.9.3-p429: 002 & gt; Article.search "Diesel" ** NoMethodError: Undefined method `stringify_keys! 'For "Diesel": /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/meta_search-1.1.3/lib/meta_search/builder.rb:86:in' build from string ** 'MetaSearch' from /home/pavel/.rvm/gems/ruby-1.9.3-p429/gems/meta_search-1.1.3/lib/meta_search/searches/active_record.rb:43: From (IRB): 2 From / home / Powell / .rvm / ratna / ruby ​​-1.9.3-p429 / gemstone / railway -3.2.8 / leib / rail / order / console From RB: 47: /home/pavel/.rvm/ Gems / Ruby-1.9.3-P429 / Gems / Railways-3.2.2 / Leib / Rail / Command / Console From RB: 8: /home/pavel/.rvm/gems/ruby-1.9.3- In P / 429 / gemstone / railway -3.2.8 / leeb / rail / command. RB: 41: `At the top (required) & gt; Script / Rail: 6: In 'Required' from Script / Rail: 6: `& lt; Main & gt; '  

What am I doing?

My app / index / article_indix. RB :

  ThinkingSphinx :: Index.define: article, with = with> : Active_Record Index: ART_ARTICLE_NR End   

(Also, I have non-standard DB, field is uppercase)

gemfile:

     

1.9.3-P 429: 003 & gt; Article.search (ART_ARTICLE_NR: "Diesel")

I am getting:

  << code>  

I have sphinx 2.0 is.4.

If you look at the stack trace, you will see that in fact Meta search returns an error, ThinkingSpinx . The point is that both gems add the search method to ActiveRecord :: Base and you get a name conflict. Actually you can call search Call for search and requires quite a different parameter. To get rid of name conflicts, add thinking-sphinx below meta_search to Gemfile. Then you can run a meta search without any error. ThinkingSphinx Search and Article Will be able to use Article.search to run .metasearch .

No comments:

Post a Comment