Issues with thinking sphinx

I recently faced some issues with thinking sphinx which sharing here so that it helps others.

Has many association not working:

I had a model named User which has many tracks and the very basic index definition is as follows:

ThinkingSphinx::Index.define :track, :with => :active_record do
indexes title
indexes [artist.first_name, artist.last_name], :as => :artist_name, :sortable => true

I was getting following error when run

rake ts:index

rake aborted!
NoMethodError: undefined method `_reflect_on_association' for #

Adding joiner gen to the Gemfile resolved my issues which I’ve got through the thinking-sphinx repository

gem 'joiner', '0.3.1'

Sphinx Guard file for index {model}_delta exists, not indexing: Removing ts-{model}_delta.tmp from db/sphinx directory resolved the issue.

Failed to start searchd daemon – Address already in use: It means somehow the process is running anywhere, nothing to do with Thinking Sphinx.

A workaround is to use a other than default port 9312 and 9306 and start/stop the server

sudo service sphinxsearch stop

Check for processes running and kill all existing:

ps -ef | fgrep searchd
killall searchd

Find that your process is being run by root, then it will keep respawning if it is set as a service. You can edit nano /etc/default/sphinxsearch and modify it from START=yes to START=no

Leave a Comment