我正在从thinking_sphinx~2.5升级到3.0.3,以遵循heroku附加组件flying_sphinx的设置说明。升级可能根本没有必要,但现在我就是这样,所以不妨完成它。
当我尝试搜索时(例如Post.search(“搜索词”)),我得到以下内容:
Can't connect to MySQL server on '127.0.0.1' (61)
我的index文件夹设置为post_index.rb
ThinkingSphinx::Index.define :post, :with => :active_record do
(. . . code here . . .)
end
我有我的config / thinking_sphinx.yml文件
development:
version: 3.0.3
mysql41: 9110
morphology: stem_en
html_strip: 1
min_infix_len: 2
bin_path: "/usr/local/bin"
searchd_binary_name: searchd
indexer_binary_name: indexer
host: 127.0.0.1
test:
version: 3.0.3
mysql41: 9110
morphology: stem_en
html_strip: 1
min_infix_len: 2
production:
version: 3.0.3
mysql41: 9110
morphology: stem_en
html_strip: 1
min_infix_len: 2
和Gemfile
gem 'mysql2', '0.3.12b5'
gem 'thinking-sphinx', '3.0.3' #'2.0.11'
gem 'flying-sphinx', '1.0.0' #'0.8.4'
我在本地和heroku运行postgres
谢谢!
现在我的thinking_sphinx.yml看起来像这样:
development:
mysql41: 9110
morphology: stem_en
html_strip: 1
min_infix_len: 2
bin_path: "/usr/local/bin"
host: 127.0.0.1
test:
mysql41: 9111
morphology: stem_en
html_strip: 1
min_infix_len: 2
production:
morphology: stem_en
html_strip: 1
min_infix_len: 2
当我尝试时 searchd目前没有运行。
Stopped searchd daemon (pid: ).
Generating configuration to /Users/Achilles/Desktop/dev/mocs/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 '/blah/blah/blah/development.sphinx.conf'...
indexing index 'post_core'...
ERROR: index 'post_core': infixes and morphology are enabled, enable_star=0
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
Failed to start searchd daemon. Check /Users/Achilles/Desktop/dev/mocs/log/development.searchd.log.
Failed to start searchd. Check the log files for more information.
答案 0 :(得分:3)
您需要更改以下内容:
version
文件中删除thinking_sphinx.yml
设置。此设置用于明确您正在使用的 Sphinx 版本,而不是 Thinking Sphinx 。mysql41
- 最好将它设置为每个开发和测试的不同值 - 因此守护进程可以同时为两个环境运行。*_binary_name
设置 - 如果您将其设置为默认值,则没有多大意义。一旦改变了,请运行rake ts:rebuild
并查看您是否可以连接......但是在这一点上,您是否需要澄清您是在本地还是在Heroku上看到此问题?