I have Sphinx and Thinking Sphinx 2.0.5 installed on my application and when I keep trying to run the command rake ts:index
it gives me this error:
rake aborted!
undefined method `indexes' for #<Riddle::Configuration:0x41b57b0>
Is is talking about my Product
model?
class Product < ActiveRecord::Base
attr_accessible :name
validates_presence_of :name
define_index do
indexes :name
end
end
Why I am getting this and how do I fix it?
According to what is written here: https://github.com/freelancing-god/thinking-sphinx/issues/301
In your Gemfile try changing:
gem 'thinking-sphinx', '2.0.5'
to
gem 'thinking-sphinx', '2.0.10'
in my Gemfile I was having entry as
gem 'thinking-sphinx', '2.0.3'
I was getting same error. Then I changed it to
gem 'thinking-sphinx', '2.0.10' and issue was solved.
Man, you can try go to the Gemfile.lock e look for those lines:
riddle (1.5.0)
thinking-sphinx (2.0.5)
activerecord (>= 3.0.3)
builder (>= 2.1.2)
riddle (>= 1.5.0)
If you read again the error you will see that is the Riddle launching error not sphinx.
*undefined method `indexes' for #<Riddle::Configuration:0x41b57b0>*
I have a project working perfectly with thinking-sphinx 2.0.5 and in the Gemfile.lock the sphinx is requiring the riddle version 1.3.3 or older so in the project that the same thinking-sphinx isn't working I changed my riddle version in gem file from 1.5.0 to 1.3.3 using thinking-sphinx 2.0.5 and the problem was solved. The sphinx version 2.0.10 works fine with riddle 1.5.0 so you have to choose if you want to change the Thinking-sphinx Gem version or the Riddle version on Gemfile.lock to:
riddle (1.3.3)
rubyzip (0.9.4)
thinking-sphinx (2.0.5)
activerecord (>= 3.0.3)
riddle (>= 1.3.3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With