我正在尝试使用 Thinking Sphinx 实现一个简单的搜索,但是它不起作用。我正在阅读“使用 Thinking Sphinx 进行设置的快速指南”,当我尝试使用时,rake ts:index
我遇到了一个令人讨厌的错误:
Generating configuration to /Users/Kuba/Desktop/Rails/black/config/development.sphinx.conf
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/Users/Kuba/Desktop/Rails/black/config/development.sphinx.conf'...
indexing index 'news_post_core'...
ERROR: index 'news_post_core': sql_connect: Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2) (DSN=mysql://root:***@localhost:3306/black1).
total 0 docs, 0 bytes
total 0.005 sec, 0 bytes/sec, 0.00 docs/sec
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
我不知道该怎么办。我唯一的索引是:
ThinkingSphinx::Index.define :news_post, :with => :active_record do
indexes title
end
我的 database.yml 是:
development:
adapter: mysql2
encoding: utf8
database: black1
pool: 5
username: root
password:
test:
adapter: mysql2
encoding: utf8
database: black1
pool: 5
username: root
password:
production:
adapter: mysql2
encoding: utf8
database: black1
pool: 5
username: root
password:
我从 Oracle 网站下载的包中安装了 MySQL。
我使用的系统是山狮。我肯定有 MySQL 服务器在运行,很容易检查系统首选项。
另外,我通过 Macports 安装了 Sphinx。对此有什么可能的解决方案?