Search code examples
ruby-on-rails-3capistranosphinxthinking-sphinx

Thinking Sphinx fails after Capistrano deployment with "unknown key name 'sql_attr_string'"


Thinking Sphinx works like a dream in my development environment of my Rails app. But when I try to deploy it via Capistrano to my production environment, it fails. I tried to go in and manually build the index and got the oddest error:

myuser@myhost:/domains/myappname.com/current$ bundle exec rake RAILS_ENV=production ts:index

Generating Configuration to /domains/myappname.com/releases/20130207221841/config/production.sphinx.conf
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/domains/myappname.com/releases/20130207221841/config/production.sphinx.conf'...
ERROR: unknown key name 'sql_attr_string' in /domains/myappname.com/releases/20130207221841/config/production.sphinx.conf line 27 col 18.
FATAL: failed to parse config file '/domains/myappname.com/releases/20130207221841/config/production.sphinx.conf'

Looking at the relevant part of the .conf file, I don't see anything particularly strange:

source piece_core_0
{
  type = mysql
  sql_host = localhost
  sql_user = [user redacted]
  sql_pass = [pass redacted]
  sql_db = [db redacted]
  sql_query_pre = SET NAMES utf8
  sql_query_pre = SET TIME_ZONE = '+0:00'
  sql_query = SELECT SQL_NO_CACHE `posts`.`id` * CAST(2 AS SIGNED) + 0 AS `id` , `posts`.`title` AS `title`, `posts`.`body` AS `body`, `users`.`name` AS `author_name`, `post$
  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `posts`
  sql_attr_uint = sphinx_internal_id
  sql_attr_uint = sphinx_deleted
  sql_attr_uint = class_crc
  sql_attr_string = sphinx_internal_class
  sql_query_info = SELECT * FROM `posts` WHERE `id` = (($id - 0) / 2)
}

Is there any explanation? I just don't see how sphinx can fail to understand something (sql_attr_string) that's clearly just a normal part of its own config file. Is this error even the real error, or is it pointing to something else being the problem?


Solution

  • It seems you are using Sphinx 0.9.9-release (r2117)

    As per sphinx documentation, sql_attr_string is only introduced in version 1.10-beta.

    Please check your production environment and have newer version to utilize this feature.