diff --git a/lib/alchemy/pg_search/engine.rb b/lib/alchemy/pg_search/engine.rb index b61fbba..66a503f 100644 --- a/lib/alchemy/pg_search/engine.rb +++ b/lib/alchemy/pg_search/engine.rb @@ -15,9 +15,11 @@ class Engine < ::Rails::Engine Alchemy::PagesController.send(:include, Alchemy::PgSearch::ControllerMethods) Alchemy::Admin::PagesController.send(:include, Alchemy::PgSearch::ControllerMethods) - # reindex the page after it was published - Alchemy.publish_targets << Alchemy::PgSearch::IndexPageJob - + # In development environment, this runs on every code reload, so avoid multiple reindexing jobs + unless Alchemy.publish_targets.map(&:name).include? 'Alchemy::PgSearch::IndexPageJob' + # reindex the page after it was published + Alchemy.publish_targets << Alchemy::PgSearch::IndexPageJob + end # enable searchable flag in page form Alchemy.enable_searchable = true