Can't reindex with sunspot / solr in rails app - Error: Severe errors in solr configuration
ruby-on-rails, solr, sunspot
Solution
I was having a very similar problem and solved it by
- stopping all running solr processes
- removing the solr folder
- turn off/restart the computer
- gem uninstall all related gems
- bundle install
- start solr
- reindex solr
Problem
Ok, so I have a simple rails application and now i'm trying to implement sunspot for search capabilities. However, after I've generated the config file with rails g sunspot_rails:install and after I've started the server and it has made the solr-dir in my rails app-dir and i run bundle exec rake sunspot:solr:reindex I get the following trace: ``` cakism@saraswati:~/railscode/calendar$ bundle exec rake sunspot:solr:reindex --trace ** Invoke sunspot:solr:reindex (first_time) ** Invoke sunspot:reindex (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute sunspot:reindex Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile rake aborted! RSolr::Error::Http - 500 Internal Server Error Error: Severe errors in solr configuration. Check your log files for more detailed information on what may be wrong. If you want solr to continue after configuration errors, change: <abortOnConfigurationError>false</abortOnConfigurationError> in null ------------------------------------------------------------- Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Event</query></delete>" Backtrace: /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:230:in `adapt_response' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:167:in `execute' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:161:in `send_and_receive' (eval):2:in `post' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:67:in `update' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:131:in `delete_by_query' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/indexer.rb:55:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `each' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:230:in `adapt_response' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:167:in `execute' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:161:in `send_and_receive' (eval):2:in `post' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:67:in `update' /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:131:in `delete_by_query' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/indexer.rb:55:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `each' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot.rb:464:in `remove_all' /var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:178:in `solr_remove_all_from_index' /var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:197:in `solr_reindex' /var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:54 /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each' /var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each' /var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:53 /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' /var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33 /var/lib/gems/1.8/bin/rake:19:in `load' /var/lib/gems/1.8/bin/rake:19 Tasks: TOP => sunspot:solr:reindex => sunspot:reindex ``` I am specially curious about this: ``` If you want solr to continue after configuration errors, change: <abortOnConfigurationError>false</abortOnConfigurationError> in null ``` Why would it say in null? Other posts with the same problem as I have has specified the solr/conf/solrconfig.xml, and also, when I change it to false, nothing else happens. If I remove the searchable block from my model, I don't get any error (but I suppose that's because it doesn't try to do anything then) I've run the config file through an XML validator, and it says it's bad start-tag name at 2<-1 5<-2 6<90%. However, even if I remove the lines which then gives a valid XML, restart solr, and try to reindex, I still get the same error. I'm starting to get desperate here, so any help is greatly appriciated!