用rails 3.2思考sphinx索引错误

时间:2013-03-08 00:45:59

标签: ruby-on-rails-3.2 indexing thinking-sphinx

我在ubuntu 12.04中安装思考sphinx时遇到了麻烦。

每当我运行rake ts:index时,我得到以下内容。

Generating configuration to /home/tom/digmenu/config/development.sphinx.conf
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/home/tom/digmenu/config/development.sphinx.conf'...
FATAL: no indexes found in config file '/home/tom/digmenu/config/development.sphinx.conf'
Generating configuration to /home/tom/digmenu/config/development.sphinx.conf
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/home/tom/digmenu/config/development.sphinx.conf'...
FATAL: no indexes found in config file '/home/tom/digmenu/config/development.sphinx.conf'

model.rb

define_index做     索引:name,as :: re_name   端

sphinx的配置文件

indexer
{
}

searchd
{
  listen = 127.0.0.1:9306:mysql41
  log = /home/tom/digmenu/log/development.searchd.log
  query_log = /home/tom/digmenu/log/development.searchd.query.log
  pid_file = /home/tom/digmenu/log/development.sphinx.pid
  workers = threads
  binlog_path = /home/tom/digmenu/tmp/binlog/development
}

我完全不知道为什么这不起作用!配置是在索引编制期间生成的,但是退出。

任何人都有任何想法?

1 个答案:

答案 0 :(得分:4)

你可能已经解决了问题,但无论如何都要解决。也许它会帮助别人。

出现这个问题的原因是你可能正在使用Thinking Sphinx 3.0或更新版本,但是以旧的方式定义你的索引,就像在Thinking Sphinx 2. *及更早版本中所做的那样。索引定义不再在模型本身中,而是在单独的文件中,这些文件放在app/indices中。还有很多其他变化,所以最好仔细阅读新文档。

3.0的文档位于自述文件中:https://github.com/pat/thinking-sphinx/

“官方”文档仍然引用旧版本,其工作方式不同:http://pat.github.com/ts/en/