Sphinx daemon returned error: index product_core: INTERNAL ERROR: Inbound schema mismatch. On staging server only

The app uses Rails 2.3.12 and ThinkingSphinx 1.4.11. There is only one index on the product model and it works fine in the devel box. Then cap staging deploy

I create a configuration on the server by creating an index and a starter 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


After going to the rails console, I get:

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


Of course, I know that creating such indexes after each cap staging deploy

is suboptimal and should be allowed in the capistrano configuration (shared section, binding, etc.), but for now I want to make it work manually, after which I will automate things.


source to share

1 answer

I got the same error and it was because I was creating 2 indices for the same field, once as an index, the other as an attribute.

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

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

In the case of the account_id above, I assume that you created it twice, hence this is an error, you only need to create it once per block define_index


has account_id


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

not required if it is already an integer, but I left it out because you can turn a non-integer field into one for weighing, like this:

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




All Articles