I recently updated Sunspot from 2.0.0 to 2.1.1 on an old project and was hit by an unexpected connection error. Locally I was using the bundled Solr server and everything was fine, however in staging and production Solr is running on separate servers and could not longer be connected to.
The key it seems was that Sunspot 2.1 introduced configuration options for solr_home
and path
. If these are not present in your sunspot.yml
then they will default to RAILS_ROOT/solr
.
To solve this issue edit your sunspot.yml and add the paths to your solr installation and the collection -
production:
solr:
hostname: my-solr-instance
port: 8982
log_level: WARNING
solr_home: /usr/local/solr
path: /solr/collection1
The actual paths you need may differ depending on how you've configured/installed Solr, but this should help anyone Googling when they find they can no longer connect to their Solr instance after upgrading to Sunspot 2.1.