I have sphinx and thinking sphinx (3.0.2) installed on mountain lion for my rails 3 app and everything seems to be running fine during the installation. My eventual plan is to work with the geodist feature of sphinx but at the moment i just wish to ensure that everything is working well.
In my model - story.rb, I have a column called title which is of string type. Accordingly, I've created in app/indices a file story_index.rb which contains:
ThinkingSphinx::Index.define :story, :with => :active_record do
indexes title
end
My rake ts:rebuild
generates the following:
Stopped searchd daemon (pid: 3185).
Generating configuration to /Users/kevin/Desktop/Development/grumpy/config/development.sphinx.conf
Sphinx 2.0.9-release (r3832)
Copyright (c) 2001-2013, Andrew Aksyonoff
Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/Users/kevin/Desktop/Development/grumpy/config/development.sphinx.conf'...
indexing index 'story_core'...
collected 2 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 2 docs, 36 bytes
total 0.016 sec, 2189 bytes/sec, 121.63 docs/sec
total 3 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
Started searchd successfully (pid: 3222).
which seems to be fine. However, when I fire up the rails console and try:
1.9.3-p327 :001 > Story.search "dinosaur"
(Object doesn't support #inspect)
=>
Connection to the DB is fine and there are some records which should fit the search criteria. Any ideas or solution would be greatly appreciated. :)
** Updated with GemFile **
gem 'jquery-rails', '2.0.2'
gem 'bootstrap-sass', '2.0.0'
gem 'devise', '2.1.2'
gem 'gon', '3.0.5'
gem 'resque', :require => 'resque/server'
gem 'resque-scheduler', :require => 'resque_scheduler'
gem 'thinking-sphinx', '3.0.2'
gem 'kaminari', '0.14.1'
As discussed in the comments, the issue is using an old version of the mysql2 gem (which Thinking Sphinx v3 uses to connect to Sphinx). The minimum requirement there is 0.3.12b4.
(For those interested in why it's not listed as a dependency of the TS gem, it's because mysql2 doesn't work with JRuby).