Sphinx 守护进程返回错误:索引 product_core:内部错误:传入架构不匹配.仅在登台服务器上 [英] Sphinx Daemon returned error: index product_core: INTERNAL ERROR: incoming-schema mismatch. Only on staging server

查看:40
本文介绍了Sphinx 守护进程返回错误:索引 product_core:内部错误:传入架构不匹配.仅在登台服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该应用程序使用 Rails 2.3.12 和 ThinkingSphinx 1.4.11.产品型号只有一个索引,在开发盒上运行正常.在 cap staging deploy 之后,我在服务器上生成配置,创建索引,并启动守护进程:

The application is using Rails 2.3.12 and ThinkingSphinx 1.4.11 . There is only one index on Product model and it is working OK on devel box. After cap staging deploy I am generating config on the server, creating index, and starting daemon:

bundle exec rake ts:conf RAILS_ENV=staging
bundle exec rake ts:index RAILS_ENV=staging
bundle exec rake ts:start RAILS_ENV=staging

进入 rails 控制台后,我得到:

After going to rails console I'm getting:

>> Product.search('music')  
 Sphinx   Sphinx Daemon returned error: index product_core: INTERNAL ERROR: incoming-      schema mismatch (in=uint account_id:32@192, my=uint account_id:32@0)
ThinkingSphinx::SphinxError: index product_core: INTERNAL ERROR: incoming-schema mismatch (in=uint account_id:32@192, my=uint account_id:32@0)
from /var/www/rebelshop_staging/rebelshop/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.4.11/lib/thinking_sphinx/search.rb:417:in `populate'
from /var/www/rebelshop_staging/rebelshop/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.4.11/lib/thinking_sphinx/search.rb:562:in `call'
from /var/www/rebelshop_staging/rebelshop/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.4.11/lib/thinking_sphinx/search.rb:562:in `retry_on_stale_index'
from /var/www/rebelshop_staging/rebelshop/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.4.11/lib/thinking_sphinx/search.rb:404:in `populate'
from /var/www/rebelshop_staging/rebelshop/shared/bundle/ruby/1.8/gems/thinking-sphinx-1.4.11/lib/thinking_sphinx/search.rb:167:in `method_missing'
from /usr/local/lib/ruby/1.8/irb.rb:310:in `output_value'
from /usr/local/lib/ruby/1.8/irb.rb:159:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /usr/local/lib/ruby/1.8/irb.rb:155:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:71:in `start'
from /usr/local/lib/ruby/1.8/irb.rb:70:in `catch'
from /usr/local/lib/ruby/1.8/irb.rb:70:in `start'
from /usr/local/bin/irb:13

当然我知道在每个 cap staging deploy 之后生成这样的索引是次优的,它应该在 capistrano staging 配置(共享部分、链接等)中解决,但现在我想得到它手动工作,之后我会自动化.

Of course I know that generating such indexes after each cap staging deploy is suboptimal and it should be solved in capistrano staging configuration (shared section, linking, etc.) but for now I want to get it working manually, after that I will automate things.

推荐答案

我遇到了同样的错误,这是因为我为同一个字段创建了 2 个索引,一个作为索引,另一个作为属性.

I got this same error and it was due to the fact that I was creating 2 indexes for the same field, once as an index, the other as an attribute.

由于 Thinking Sphinx 语法与常规 sphinx.conf 语法完全不同,因此可能会非常混乱.对于常规 sphinx.conf,您必须创建普通字段,然后还必须创建与 CRC32 整数相同的字段,以便将它们用于加权.

Since the Thinking Sphinx syntax is quite different than the regular sphinx.conf syntax it can be very confusing. For regular sphinx.conf you have to create normal fields and then you also have to create the same fields as CRC32 integers in order to use them for weighting.

在 Thinking Sphinx 中,您不需要这样做.

In Thinking Sphinx you don't need to do this.

在上面的 account_id 的情况下,我猜你已经创建了两次,因此错误,你只需要在模型的 define_index 块中创建一次:

In the case of account_id above I'm guessing you have it created twice, hence the error, you only need to create it once in the model's define_index block:

has account_id

或者,如果您需要将 account_id 字段用于其他用途,请为 Sphinx 属性创建另一个别名:

Or if you need the account_id field for something else, create another alias for the Sphinx attribute:

indexes account_id
has account_id, :type => :integer, :as => :account_id_attribute

:type =>:integer 如果它已经是一个整数就没有必要,但我留下它是因为你可以将一个非整数字段转换为一个以进行加权,例如:

The :type => :integer is not necessary if it's already an integer, but I left it because you can turn a non-integer field into one for weighing purposes, for example:

has "CRC32(media)", :type => :integer, :as => :media

这篇关于Sphinx 守护进程返回错误:索引 product_core:内部错误:传入架构不匹配.仅在登台服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆