0

When I run RAILS_ENV=production rake sunspot:solr:reindex, I receive the following error message:

rake aborted!
RSolr::Error::Http: RSolr::Error::Http - 404 Not Found

...

URI: http://localhost:8080/solr/default/update?wt=ruby
Request Headers: {"Content-Type"=>"text/xml"}
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Piece</query></delete>"

I've used this tutorial to set up Solr, also referencing this page for specific Sunspot configuration. My config/environments/production.rb file includes: Sunspot.config.solr.url = 'http://localhost:8080/solr' and my config/sunspot.yml file looks like the following:

production:
  solr:
    hostname: localhost
    port: 8080 #tomcat defaults to port 8080
    path: '/solr'
    log_level: WARNING
    pid_dir: '/var/run'
    solr_home: solr

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO
    path: /solr/development
    solr_home: solr

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING
    path: /solr/test

I've tried everything outlined in similar posts--killing all Solr processes, starting and stopping the Solr server, deleting the entire solr directory, adding to my config files, etc. None of them have worked. I can manually access [hostname]:8080/solr, but I simply cannot reindex or seed my db.

23049581029
  • 355
  • 1
  • 2
  • 12
  • 1
    Possible duplicate of [Rails app: Solr throwing RSolr::Error::Http - 404 Not Found when executing search](http://stackoverflow.com/questions/19759906/rails-app-solr-throwing-rsolrerrorhttp-404-not-found-when-executing-searc) – Brad Werth Nov 09 '15 at 08:21

1 Answers1

0

I found that the issue was that this Solr installation has a different schema.xml file than the schema.xml file that must be used for Sunspot. What I did was I copied the schema.xml file on my local machine and pasted it into the schema.xml in /usr/share/solr/conf/schema.xml on my production machine. I restarted the Solr instances and deleted the Solr file in the rails application. I also messed with the config files quite a bit. I removed the line in the production.rb file and my sunspot.yml file looks like:

production:
  solr:
    hostname: localhost
    port: 8080 #tomcat defaults to port 8080
    path: /solr
    log_level: WARNING
    solr_home: solr

Really a pain...I hope this gem will be better documented for production use in the future.

23049581029
  • 355
  • 1
  • 2
  • 12