Rake task aborted, undefined method 'indexes' for Thinking Sphinx?
Asked Answered
R

3

8

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?

Rorrys answered 7/11, 2011 at 11:19 Comment(2)
We can't know if it is talking about the Product model. Did you try running rake ts:index --trace? You will get a stacktrace that way.Oversold
@Oversold Ok I ran rake ts:index --trace and here is my gist.github.com/1345070 so you can look at it.Rorrys
A
16

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'
Amid answered 7/11, 2011 at 15:7 Comment(0)
C
1

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.

Calibrate answered 17/11, 2011 at 6:38 Comment(0)
H
1

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)
Hawken answered 23/11, 2012 at 16:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.