Commit fb59b727 by Diana Huang

Better filtering for rake search:initialize behavior

parent 1235e147
......@@ -16,7 +16,8 @@ end
LOG = Logger.new(STDERR)
RAKE_SEARCH_INITIALIZE = (Rake.application.top_level_tasks.include? 'search:initialize')
# Indicates whether this is being run from within a 'search:' task in rake.
RAKE_SEARCH = (Rake.application.top_level_tasks.select {|task| task.include? 'search:'}).any?
desc 'Load the environment'
task :environment do
......
......@@ -72,7 +72,7 @@ Dir[File.dirname(__FILE__) + '/models/*.rb'].each { |file| require file }
Dir[File.dirname(__FILE__) + '/presenters/*.rb'].each { |file| require file }
$check_index_mapping_exists = defined?(RAKE_SEARCH_INITIALIZE) === nil || RAKE_SEARCH_INITIALIZE === false
$check_index_mapping_exists = defined?(RAKE_SEARCH) === nil || RAKE_SEARCH === false
if $check_index_mapping_exists
# Ensure Elasticsearch index mappings exist, unless we are creating it in the rake search initialize
Comment.put_search_index_mapping
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment