Search code examples
solrruby-on-rails-3.2sunspot-solrwebsolr

Same database, different Solr indexes


I have an application on Heroku that's using the WebSolr addon. The WebSolr index is returning results that do not exist in the database (ie. returns 10 ID's of which only two exist).

When I download the production database onto the local machine and reindex the local Solr instance I get valid results.

I tried:

  • Reindexing the model giving me trouble heroku run rake sunspot:solr:reindex[1000,Model]
  • Reindexing the whole thing heroku run rake sunspot:solr:reindex, also tried heroku run rake sunspot:reindex

This gave me no results. Is there a way to totally reset the WebSolr index without significant downtime (ie. the it takes to reindex) on production?

I'm using:

  • sunspot_solr (2.1.0)
  • rails (3.2.18)
  • Solr 4.4.0 (as reported in the WebSolr addon page)

Solution

  • There was an issue with Solr 4 indices silently ignoring delete messages, which resulted in situations like you've described. The issue was fixed some time ago, but indices created before the fix was deployed are still subject to this behavior.

    Fortunately, the solution is fairly simple. Delete the current index (the red button marked "Destroy this index") and create a new Solr 4.4 index. Changes to your database will now be reflected in your Solr index.

    If you have any problems or questions, feel free to open a support ticketor shoot us an email at support at onemorecloud.com