about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-28 13:01:33 +0100
committerThibaut Girka <thib@sitedethib.com>2019-03-28 13:01:33 +0100
commit050efbc12650feaac3e833c4dd740bf090e3dae1 (patch)
tree260458c7ff43dd82fc02cc7e5ef0920dd8d2a25b /lib
parent0418bdd71f59b4d7e9f3498f2990c8b044f310e1 (diff)
parent24d5b6f9e39d2ac62a9657c7d19bc8c437b0735b (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/workers/activitypub/distribute_poll_update_worker.rb
- config/locales/pl.yml
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.rb4
-rw-r--r--lib/mastodon/search_cli.rb22
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/cli.rb b/lib/cli.rb
index 59f0f3076..65a5ae696 100644
--- a/lib/cli.rb
+++ b/lib/cli.rb
@@ -5,6 +5,7 @@ require_relative 'mastodon/media_cli'
 require_relative 'mastodon/emoji_cli'
 require_relative 'mastodon/accounts_cli'
 require_relative 'mastodon/feeds_cli'
+require_relative 'mastodon/search_cli'
 require_relative 'mastodon/settings_cli'
 require_relative 'mastodon/statuses_cli'
 require_relative 'mastodon/domains_cli'
@@ -28,6 +29,9 @@ module Mastodon
     desc 'feeds SUBCOMMAND ...ARGS', 'Manage feeds'
     subcommand 'feeds', Mastodon::FeedsCLI
 
+    desc 'search SUBCOMMAND ...ARGS', 'Manage the search engine'
+    subcommand 'search', Mastodon::SearchCLI
+
     desc 'settings SUBCOMMAND ...ARGS', 'Manage dynamic settings'
     subcommand 'settings', Mastodon::SettingsCLI
 
diff --git a/lib/mastodon/search_cli.rb b/lib/mastodon/search_cli.rb
new file mode 100644
index 000000000..42ad93f1e
--- /dev/null
+++ b/lib/mastodon/search_cli.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require_relative '../../config/boot'
+require_relative '../../config/environment'
+require_relative 'cli_helper'
+
+module Mastodon
+  class SearchCLI < Thor
+    desc 'deploy', 'Create or update an ElasticSearch index and populate it'
+    long_desc <<~LONG_DESC
+      If ElasticSearch is empty, this command will create the necessary indices
+      and then import data from the database into those indices.
+
+      This command will also upgrade indices if the underlying schema has been
+      changed since the last run.
+    LONG_DESC
+    def deploy
+      processed = Chewy::RakeHelper.upgrade
+      Chewy::RakeHelper.sync(except: processed)
+    end
+  end
+end