From 2c15e9c6fe1b96739257c0d152508a3c6680ef78 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Tue, 24 Oct 2017 17:55:05 -0400 Subject: [PATCH] FIX: search couldn't find tags from before 2017-08-25 --- app/jobs/onceoff/create_tags_search_index.rb | 9 +++++++++ lib/tasks/search.rake | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 app/jobs/onceoff/create_tags_search_index.rb diff --git a/app/jobs/onceoff/create_tags_search_index.rb b/app/jobs/onceoff/create_tags_search_index.rb new file mode 100644 index 00000000000..3e673bf2e69 --- /dev/null +++ b/app/jobs/onceoff/create_tags_search_index.rb @@ -0,0 +1,9 @@ +module Jobs + class CreateTagsSearchIndex < Jobs::Onceoff + def execute_onceoff(args) + Tag.exec_sql('select id, name from tags').each do |t| + SearchIndexer.update_tags_index(t['id'], t['name']) + end + end + end +end diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake index ef84747cce4..7d1ce3ab30c 100644 --- a/lib/tasks/search.rake +++ b/lib/tasks/search.rake @@ -42,6 +42,15 @@ def reindex_search(db = RailsMultisite::ConnectionManagement.current_db) id = c["id"] name = c["name"] SearchIndexer.update_categories_index(id, name) + + putc '.' + end + + puts '', 'Tags' + + Tag.exec_sql('select id, name from tags').each do |t| + SearchIndexer.update_tags_index(t['id'], t['name']) + putc '.' end puts