If you are using the reindex
method to reindex your records in your Rails app and have used the Algolia Dashboard to change Settings, Rules or Synonyms, the reindex
method will delete or reset them, as it recreates your index configuration as defined in your Rails project.
More information on how the reindex method operates can be found here.
To prevent this, you can turn off automatic syncing using check_settings:false
as outlined here: https://www.algolia.com/doc/framework-integration/rails/indexing/indexing/?client=ruby#zero-downtime-reindexing.
This will create a temporary index that maintains Rules, Synonyms and Settings as it stops the gem from syncing all settings. Your original configurations will therefore be maintained when the temporary index overwrites your original index.
Please note, if you then modify settings in the algoliasearch
block, you will need to apply them with the rake command rake algoliasearch:set_all_settings
, which will update your primary indices, replicas and any indices you added with add_index
.
Alternatively, you can set rules using the API client as opposed to the dashboard. You can find more information on Rules methods here: https://www.algolia.com/doc/api-client/methods/rules/.