思考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)
}
有没有解释?我只是没有看到狮身人面像怎么能理解某些东西(sql_attr_string
),这显然只是它自己的配置文件的正常部分。这个错误甚至是真正的错误,还是指向其他问题?
答案 0 :(得分:1)
您似乎正在使用Sphinx 0.9.9-release(r2117)
根据sphinx documentation,sql_attr_string
仅在版本 1.10-beta中引入。
请检查您的生产环境并使用更新的版本来使用此功能。