Sunspot for Solr fails with '400 Bad Request' in 'adapt_response'

If Sunspot does not work and fails with a backtrace similar to this:

/project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:227:in `adapt_response'
/project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:164:in `execute'
/project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:158:in `send_and_receive'
(eval):2:in `post'

then the schema.xml that is shipped with Sunspot is not loaded into Solr correctly.

Often the latter can be found in /etc/solr/conf/schema.xml. So copy Sunspot's schema.xml there, restart Solr and you should be fine.

Thomas Eisenbarth