0

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?

isthmuses
  • 1,316
  • 1
  • 17
  • 27

1 Answers1

1

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.

Community
  • 1
  • 1
Minesh
  • 2,284
  • 1
  • 14
  • 22
  • Thank you! That's unexpected that the Thinking Sphinx gem and/or Bundler doesn't manage the version/dependency of Sphinx itself! It looks like Sphinx 2.0 is standard with Ubuntu 12.04, so that's a good excuse for an upgrade. – isthmuses Feb 08 '13 at 18:20