【问题标题】:Unable to start sphinx in rails 4无法在 Rails 4 中启动 sphinx
【发布时间】:2014-04-02 05:41:43
【问题描述】:

我已经使用 pgsql 从源代码安装了 Sphinx,然后在我的应用程序(Rails 4.0.3)上安装了 thinking-sphinx gem(3.0.1)。我配置并生成了狮身人面像配置。然后我在 app/indices 上添加了索引,然后运行索引并通过 rake ts:index && ts:start 启动 sphinx,但出现以下错误,请告诉我解决此问题的方法。

rake ts:index

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

Sphinx 2.1.7 版本 (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:开始

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

[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!

【问题讨论】:

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


    【解决方案1】:

    也在 Thinking Sphinx Google 小组中解决了这个问题:

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

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

    但是,您还使用了 min_infix_len 或 min_prefix_len - 在 Sphinx 2.1 中,默认 dict 设置与所需内容不匹配(如日志详细信息所示)。因此,如果您在 config/thinking_sphinx.yml 中将 dict: 关键字添加到适当的环境中,然后运行 ​​ts:regenerate,那么您应该希望有一个有效的 Sphinx 设置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-30
      • 1970-01-01
      相关资源
      最近更新 更多