Can't reindex with sunspot / solr in rails app - Error: Severe errors in solr configuration

后端 未结 7 935
我在风中等你
我在风中等你 2021-02-01 10:42

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

相关标签:
7条回答
  • 2021-02-01 11:05

    or you can re install the gem. This works for me.

    0 讨论(0)
  • 2021-02-01 11:07

    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
    0 讨论(0)
  • 2021-02-01 11:07

    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

    0 讨论(0)
  • 2021-02-01 11:08

    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.

    0 讨论(0)
  • 2021-02-01 11:15

    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
    
    0 讨论(0)
  • 2021-02-01 11:18

    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

    1. Go to app root directory.
    2. using ps aux | grep solr find solr process ID
    3. stop solr process using kill -9 4313 # for me 4313 was solr process id
    4. start solr on staging rake sunspot:solr:start RAILS_ENV=staging

    5. re-index solr using rake sunspot:solr:reindex RAILS_ENV=staging

    That's it.

    N.B: Replace environment according your need

    0 讨论(0)
提交回复
热议问题