Thinking Sphinx在我的Rails应用程序开发环境中像做梦一样工作。但是,当我尝试通过Capistrano将它部署到我的生产环境中时,它失败了。我试着进去手动构建索引,结果出现了最奇怪的错误:
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'
查看.conf
文件的相关部分,我没有看到任何特别奇怪的东西:
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)
}
有什么解释吗?我只是不明白sphinx怎么会不理解它自己的配置文件中正常的部分(sql_attr_string
)。这个错误是真正的错误吗?还是它指向了其他问题?
您似乎在使用Sphinx0.9.9版本(r2117)
根据斯芬克斯文件,sql_attr_string
仅在1.10-beta版本中引入。
请检查您的生产环境,并使用更新的版本来使用此功能。