问题
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
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
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.
回答1:
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.
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.
In Thinking Sphinx you don't need to do this.
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
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
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
来源:https://stackoverflow.com/questions/9665449/sphinx-daemon-returned-error-index-product-core-internal-error-incoming-schem