Search code examples
ruby-on-railsrubyherokusphinxthinking-sphinx

ThinkingSphinx (and Heroku Flying Sphinx) - getting unknown column error


I'm working on a Rails app where I use ThinkingSphinx for search. It's deployed on Heroku where I use their plugin Flying Sphinx. On my local development machine it works, but at first I got the same error:

ThinkingSphinx::SphinxError (unknown column: 'question' ...

Performing:

rake ts:rebuild

Was enough to make it work on my local machine. But I continue to get the same error in my production environment despite using:

heroku run bundle exec flying-sphinx rebuild

The relevant index file looks like this:

ThinkingSphinx::Index.define :competition, :with => :real_time do
  indexes name
  # This index seems to be causing the error:
  indexes question
  indexes user(:name), as: :idea_user
  indexes taggings.tag(:name), :as => :idea_tags

  has user_id, type: :integer
  has team_id, type: :integer
  has created_at, type: :timestamp
  has updated_at, type: :timestamp

  has start_date, type: :timestamp
  has end_date, type: :timestamp

end

My question property was previously called description. I thought that running:

heroku run bundle exec flying-sphinx rebuild 

Would be enough to update my indexes (it was enough on my local machine), but it didn't seem to help.

Any ideas on how I can solve this?


Solution

  • The DNSimple downtime certainly didn't help.

    Also, you want to run regenerate rather than rebuild given you're using real-time indices:

    heroku run bundle exec flying-sphinx regenerate