1
votes

I am trying to setup solr sunspot search in production mode.

I have followed the below tutorial and got success in setting up tomcat-solr server running. http://www.arborisoft.com/how-to-install-apache-solr-4-4-on-ubuntu-12-04/

I ran

rails generate sunspot_rails:install

and configured the config/sunspot.yml file.

For development mode I used 'sunspot_solr' gem(which is not advisable for production mode) and got this command working.

bundle exec rake sunspot:solr:start

When I removed this gem

it's giving me following error

  Note: This task has been moved to the sunspot_solr gem. To install, start and
  stop a local Solr instance, please add sunspot_solr to your Gemfile:

  group :development do
    gem 'sunspot_solr'
  end

I have tried adding this to Rakefile:

require 'sunspot/solr/tasks'

when I run the following command

bundle exec rake app:sunspot:solr:start

I am getting the following error

rake aborted!
cannot load such file -- sunspot/solr/tasks

I am using rails 4.

I don't know what I've missed. I have searched for the solution in and out of stackoverflow. But I couldn't get any reference. Even if I find any since I am a rails noob, I couldn't understand what they are talking about. any solution will be really helpful.

1

1 Answers

1
votes

You can also change the path to solr/default in config/sunspot.yml file for production mode or any other defined modes.
These are some terminal commands which could follow to solve your problems:

  1. ps aux | grep solr to get solr process ID
    through this you can check which server id is running and which one is in your sunspot pid file.
  2. sudo kill <ID>, <ID> is the ID you found from 1
  3. rm -r <path/to/solr>, remove the solr directory inside your project to remove all of previous indexes
  4. RAILS_ENV=production bundle exec rake sunspot:solr:start
  5. Change the path to /solr/default inside config/sunspot.yml
  6. RAILS_ENV=production bundle exec rake sunspot:solr:reindex

this link can also help in understanding problem and issues:https://github.com/sunspot/sunspot/issues/492