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_ra
or you can re install the gem. This works for me.
I was having a very similar problem and solved it by
More specifically, I found out the cause for my problem, hope this helps any souls who was wondering what happened
First, I deleted the solr/data folder. Bad idea. And this caused the errors as described by cakism.
Restarting, deleting solr folder, etc. won't help. Simply because there is an instance of Solr server running and it will not be stopped even with sunspot:solr:stop. You have to kill that instance by:
rake sunspot:solr:stop # stop server
ps -A | grep solr # you'll see the [PID] of the solr server
kill [PID] # replace with the [PID] from above to completely kill the solr instance
After this, you can then proceed with deleting the solr folder and starting the server again
I was facing same issue, and finally I got config/database.yml has wrong database name and, than I checked sunspot.yml, this file has also wrong configuration like ip address. I modify both of file than it start to work.
Here is the easy way (does not require messing with gems or restarting computer):
rake sunspot:solr:stop
If you have modified the schema, copy the contents of site_root/solr/conf/schema.xml
to your clipboard
Next, delete the entire solr folder at site_root/solr
Now run:
rake sunspot:solr:start
This command will create and repopulate the deleted solr folder.
If you copied schema.xml above, open schema.xml again, select everything, and copy the contents of your clipboard. Save the file.
Now run:
bundle exec rake sunspot:solr:reindex
For me, there was so much dependency with turn off/restart the computer
(It was not possible to restart) and does not work any thing from above(I am not trying with restart). So, my working solution was
ps aux | grep solr
find solr process ID
kill -9 4313
# for me 4313 was solr process idstart solr on staging rake sunspot:solr:start RAILS_ENV=staging
re-index solr using rake sunspot:solr:reindex RAILS_ENV=staging
That's it.
N.B: Replace environment according your need