无法在导轨4中启动sphinx

时间:2014-04-02 05:41:43

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

我已经使用pgsql从源代码安装了Sphinx,然后在我的应用程序(Rails 4.0.3)上安装了think-sphinx gem(3.0.1)。我配置了&生成了狮身人面像配置。然后我在app / indices上添加了索引,然后运行了索引&通过rake ts:index&&开始狮身人面像ts:开始,但是我得到了以下错误,让我知道解决这个问题的方法。

  

rake ts:index

将配置生成为/home/stc/presto/config/development.sphinx.conf

  
    

Sphinx 2.1.7-release(rel21-r4638)

         

版权所有(c)2001-2014,Andrew Aksyonoff

         

版权所有(c)2008-2014,Sphinx Technologies Inc(http://sphinxsearch.com

         

使用配置文件'/home/stc/config/development.sphinx.conf'...

         

致命:在配置文件'/home/stc/config/development.sphinx.conf'中找不到索引

  
     

rake ts:start

在日志文件中,我可以看到以下错误

[Wed Apr  2 10:40:49.834 2014] [14338] Child process 14339 has been forked
[Wed Apr  2 10:40:49.835 2014] [14339] listening on 127.0.0.1:9306
[Wed Apr  2 10:40:49.835 2014] [14339] WARNING: ERROR: index 'collection_core': RT indexes support prefixes and infixes with only dict=keywords - NOT SERVING
[Wed Apr  2 10:40:49.836 2014] [14339] WARNING: ERROR: index 'resource_core': RT indexes support prefixes and infixes with only dict=keywords - NOT SERVING
[Wed Apr  2 10:40:49.836 2014] [14339] WARNING: index 'collection': no such local index 'collection_core' - SKIPPING LOCAL INDEX
[Wed Apr  2 10:40:49.836 2014] [14339] WARNING: index 'collection': no valid local/remote indexes in distributed index - NOT SERVING
[Wed Apr  2 10:40:49.836 2014] [14339] WARNING: index 'resource': no such local index 'resource_core' - SKIPPING LOCAL INDEX
[Wed Apr  2 10:40:49.836 2014] [14339] WARNING: index 'resource': no valid local/remote indexes in distributed index - NOT SERVING
[Wed Apr  2 10:40:49.836 2014] [14339] FATAL: no valid indexes to serve
[Wed Apr  2 10:40:49.836 2014] [14338] Child process 14339 has been finished, exit code 1. Watchdog finishes also. Good bye!

1 个答案:

答案 0 :(得分:0)

还在Thinking Sphinx Google小组上解决了这个问题:

您似乎正在使用实时索引 - 这很棒 - 但这意味着您不需要使用ts:index任务。有用的两个主要任务是:

  • ts:generate - 添加/更新每个实时索引中的所有文档。
  • ts:regenerate - 停止Sphinx,清除现有索引文件,生成配置,启动Sphinx并运行ts:generate。

但是,您还使用min_infix_len或min_prefix_len - 并且对于Sphinx 2.1,默认的dict设置与所需的设置不匹配(如日志详细信息)。因此,如果你将dict:keywords添加到config / thinking_sphinx.yml中的相应环境中,然后运行ts:regenerate,你应该希望有一个有效的Sphinx设置。