当前位置: 动力学知识库 > 问答 > 编程问答 >

Unable to start sphinx in rails 4

问题描述:

I have installed Sphinx from source with pgsql and then installed thinking-sphinx gem(3.0.1) on my application (Rails 4.0.3). And I configured & generated the sphinx configurations. Then I added the indices on app/indices and later ran the index & start the sphinx via rake ts:index && ts:start, but I got the below error, let me know the way to resolve this.

rake ts:index

Generating configuration to /home/stc/presto/config/development.sphinx.conf

Sphinx 2.1.7-release (rel21-r4638)

Copyright (c) 2001-2014, Andrew Aksyonoff

Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/home/stc/config/development.sphinx.conf'...

FATAL: no indexes found in config file '/home/stc/config/development.sphinx.conf'

rake ts:start

In the log file I can see the below errors

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

网友答案:

Addressed this on the Thinking Sphinx Google group as well:

You seem to be using real-time indices - which is great - but that means you dont need to use the ts:index task. The two main tasks that are useful are:

  • ts:generate - which adds/updates all documents in each real-time index.
  • ts:regenerate - which stops Sphinx, clears out existing index files, generates the configuration, starts Sphinx and runs ts:generate.

However, youre also using either min_infix_len or min_prefix_len - and with Sphinx 2.1, the default dict setting doesnt match with what is needed (as the logs detail). So, if you add dict: keywords to the appropriate environments in config/thinking_sphinx.yml and then run ts:regenerate, you should hopefully have a working Sphinx setup.

分享给朋友:
您可能感兴趣的文章:
随机阅读: