about summary refs log tree commit diff
path: root/lib/mastodon
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2021-01-09 03:51:32 +0100
committerGitHub <noreply@github.com>2021-01-09 03:51:32 +0100
commit93951431269403201550e914dee508a522becf8b (patch)
tree793cd1ffec4a22989260700ba696d8f8a7e92582 /lib/mastodon
parent73ddb60c32090c9685f3b74e0bbb4a06b34a7083 (diff)
Fix maintenance script not re-indexing some indexes on textual values (#15515)
* Fix maintenance script not re-indexing some indexes on textual values

Fixes #15475

* Refresh instance view at the end of the maintenance script run

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'lib/mastodon')
-rw-r--r--lib/mastodon/maintenance_cli.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/mastodon/maintenance_cli.rb b/lib/mastodon/maintenance_cli.rb
index 822051ceb..029d42a05 100644
--- a/lib/mastodon/maintenance_cli.rb
+++ b/lib/mastodon/maintenance_cli.rb
@@ -160,6 +160,7 @@ module Mastodon
       deduplicate_tags!
       deduplicate_webauthn_credentials!
 
+      Scenic.database.refresh_materialized_view('instances', concurrently: true, cascade: false) if ActiveRecord::Migrator.current_version >= 2020_12_06_004238
       Rails.cache.clear
 
       @prompt.say 'Finished!'
@@ -188,6 +189,11 @@ module Mastodon
       else
         ActiveRecord::Base.connection.add_index :accounts, "lower (username), COALESCE(lower(domain), '')", name: 'index_accounts_on_username_and_domain_lower', unique: true
       end
+
+      @prompt.say 'Reindexing textual indexes on accounts…'
+      ActiveRecord::Base.connection.execute('REINDEX INDEX search_index;')
+      ActiveRecord::Base.connection.execute('REINDEX INDEX index_accounts_on_uri;')
+      ActiveRecord::Base.connection.execute('REINDEX INDEX index_accounts_on_url;')
     end
 
     def deduplicate_users!