Trying to use Thinking Sphinx for search. Followed this Railscast by homebrew installing TS and MySQL (though I'm using pg in my app, it's apparently required), adding these lines to my gemfile:
gem 'mysql2'
gem 'thinking-sphinx'
and putting the following in my model, below everything else
post.rb
class Post < ActiveRecord::Base
#...
define_index do
indexes content
indexes :name
end
end
Then I go into the terminal and try rake ts:index, but I get this error:
using config file '/Users/<personal>/rails_projects/<personal>/config/development.sphinx.conf'...
FATAL: no indexes found in config file '/Users/<personal>/rails_projects/<personal>/config/development.sphinx.conf'
Fished around on the internet and found nothing that quite answered this. I've tried running rake ts:configure (which doesn't complain) and then rake ts:index, but it doesn't work.
Some background: I just changed my terminal shell (to use zsh), which made all sorts of weird unexpected changes. I had to reinstall bundler, then re-bundle install all my gems, then independently gem install rake. Then I bundle updated for good measure. Now rake seems to work, but I still get the error.
The config file the error is grumbling about:
indexer
{
}
searchd
{
listen = 127.0.0.1:9306:mysql41
log = /Users/<personal>/rails_projects/<personal>/log/development.searchd.log
query_log = /Users/<personal>/rails_projects/<personal>/log/development.searchd.query.log
pid_file = /Users/<personal>/rails_projects/<personal>/log/development.sphinx.pid
workers = threads
binlog_path = /Users/<personal>/rails_projects/<personal>/tmp/binlog/development
}
Any ideas what's going on / what code the answer might be in?
INTERESTING UPDATE -- I followed the Q&A on this Google Group to enter my rails console and type "Post.sphinx_indexes.length", but I got this very different error in return. Looks like my model is somehow not getting access to the gem?
NoMethodError: undefined method `define_index' for #<Class:0x007f9c06c611b0>
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/dynamic_matchers.rb:55:in `method_missing'
from /Users/<personal>/rails_projects/<personal>/app/models/post.rb:55:in `<class:Post>'
from /Users/<personal>/rails_projects/<personal>/app/models/post.rb:13:in `<top (required)>'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:469:in `load'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:469:in `block in load_file'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:639:in `new_constants_in'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:468:in `load_file'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:353:in `require_or_load'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:502:in `load_missing_constant'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:192:in `block in const_missing'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `each'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `const_missing'
from (irb):1
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /Users/<personal>/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'irb(main):002:0>