Rails中的Sphinx - 错误:索引'user_core':sql_connect:致命:角色“root”不存在

时间:2013-04-03 07:41:25

标签: ruby-on-rails postgresql sphinx thinking-sphinx

当我运行rake ts:index时,我收到以下错误:

Generating Configuration to /Users/main/rails_projects/glassboard/config/development.sphinx.conf
Sphinx 2.0.4-release (r3135)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/Users/main/rails_projects/glassboard/config/development.sphinx.conf'...
indexing index 'user_core'...
ERROR: index 'user_core': sql_connect: FATAL:  role "root" does not exist
 (DSN=pgsql://root:***@localhost:5432/glassboard_development).
total 0 docs, 0 bytes
total 0.005 sec, 0 bytes/sec, 0.00 docs/sec
skipping non-plain index 'user'...
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

我在网上找不到这个错误,Sphinx对我的数据库有什么问题?

我的操作系统是Mac 10.6.8,我正在使用(PostgreSQL)9.1.4。

1 个答案:

答案 0 :(得分:2)

您使用的是哪种版本的Thinking Sphinx?很久以前就有一个bug假定默认数据库用户是root用户(如果没有指定)(适用于MySQL,但不适用于PostgreSQL),但这是固定的。我建议更新到你正在使用的任何Rails的最新版本(Rails 2:TS 1.4.14,Rails 3:TS 2.0.14)。

或者,如果你使用的是Rails 3.1或更新版本,你可以更新到TS 3.0.2 - 但是那里有重大变化:http://pat.github.com/thinking-sphinx/upgrading.html