Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Sphinx守护程序返回错误:索引产品\u核心:内部错误:传入架构不匹配。仅在临时服务器上_Ruby On Rails_Sphinx_Thinking Sphinx - Fatal编程技术网

Ruby on rails Sphinx守护程序返回错误:索引产品\u核心:内部错误:传入架构不匹配。仅在临时服务器上

Ruby on rails Sphinx守护程序返回错误:索引产品\u核心:内部错误:传入架构不匹配。仅在临时服务器上,ruby-on-rails,sphinx,thinking-sphinx,Ruby On Rails,Sphinx,Thinking Sphinx,该应用程序使用Rails 2.3.12和ThinkingSphinx 1.4.11。产品模型上只有一个索引,它在develbox上运行正常。在cap staging deploy之后,我将在服务器上生成配置,创建索引,并启动守护程序: 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 2.3.12和ThinkingSphinx 1.4.11。产品模型上只有一个索引,它在develbox上运行正常。在
cap staging deploy
之后,我将在服务器上生成配置,创建索引,并启动守护程序:

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控制台后,我得到:

>> 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配置(共享部分、链接等)中解决,但现在我想让它手动工作,之后,我将自动执行操作。

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

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

在思考斯芬克斯时,你不需要这样做

对于上面的account_id,我猜您已经创建了两次,因此出现了错误,您只需要在模型的
define_index
块中创建一次:

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

indexes account_id
has account_id, :type => :integer, :as => :account_id_attribute
如果已经是整数,则不需要使用
:type=>:integer
,但我保留了它,因为您可以将非整数字段转换为一个用于称重的字段,例如:

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

谢谢你的回答。我已经设法解决了,但那是很久以前的事了,所以我甚至不记得是什么原因造成的。这是我以前的工作,所以我没有回购协议的权限来检查它。无论如何,你的信息丰富的答案可能会帮助其他人处理类似的问题。