Skip to content

Instantly share code, notes, and snippets.

@joost
Created March 27, 2015 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joost/6362c2f4ec388b91380b to your computer and use it in GitHub Desktop.
Save joost/6362c2f4ec388b91380b to your computer and use it in GitHub Desktop.
Sunspot reindex without removing the index
class YourModel
# Overwrite sunspot version to not remove from index.
# See: https://github.com/sunspot/sunspot/blob/16e5f620814fd4bdf43e3df158e7fdcbbd92713b/sunspot_rails/lib/sunspot/rails/searchable.rb#L206
def self.solr_reindex(options = {})
solr_index(options)
solr_clean_index_orphans
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment