0

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),这显然只是它自己的配置文件的正常部分。这个错误甚至是真正的错误,还是指向其他问题?

4

1 回答 1

1

看来您正在使用 Sphinx 0.9.9-release (r2117)

根据sphinx 文档sql_attr_string仅在1.10-beta 版中引入。

请检查您的生产环境并安装更新版本以使用此功能。

于 2013-02-08T09:28:59.280 回答