search_cli.rb 686 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. require_relative '../../config/boot'
  3. require_relative '../../config/environment'
  4. require_relative 'cli_helper'
  5. module Mastodon
  6. class SearchCLI < Thor
  7. desc 'deploy', 'Create or update an ElasticSearch index and populate it'
  8. long_desc <<~LONG_DESC
  9. If ElasticSearch is empty, this command will create the necessary indices
  10. and then import data from the database into those indices.
  11. This command will also upgrade indices if the underlying schema has been
  12. changed since the last run.
  13. LONG_DESC
  14. def deploy
  15. processed = Chewy::RakeHelper.upgrade
  16. Chewy::RakeHelper.sync(except: processed)
  17. end
  18. end
  19. end