Replace Search::Index with Search::Records

Lean on ActiveRecord models for searching and strip out the raw SQL.
Replaces the search_index_* tables with sharded search_records_* tables
as that allows us to use a Search::Record model name.

A Class is dynamically created for each record table shard so that we
and we can access it via the Search::Record.for_account(account_id)
method.
This commit is contained in:
Donal McBreen
2025-11-13 18:08:29 +00:00
committed by Mike Dalessio
parent fe6df7085f
commit 28efe28f24
15 changed files with 484 additions and 427 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
namespace :search do
desc "Reindex all cards and comments in the search index"
task reindex: :environment do
puts "Clearing search index shards..."
16.times do |i|
ActiveRecord::Base.connection.execute("DELETE FROM search_index_#{i}")
puts "Clearing search records..."
Search::Record::SHARD_COUNT.times do |shard_id|
ActiveRecord::Base.connection.execute("DELETE FROM search_records_#{shard_id}")
end
puts "Reindexing cards..."