account_key is MySQL specific
This commit is contained in:
@@ -33,7 +33,6 @@ module Searchable
|
||||
def search_record_attributes
|
||||
{
|
||||
account_id: account_id,
|
||||
account_key: "account#{account_id}",
|
||||
searchable_type: self.class.name,
|
||||
searchable_id: id,
|
||||
card_id: search_card_id,
|
||||
|
||||
@@ -6,7 +6,7 @@ module Search::Record::Trilogy
|
||||
included do
|
||||
self.abstract_class = true
|
||||
|
||||
before_save :stem_content
|
||||
before_save :set_account_key, :stem_content
|
||||
end
|
||||
|
||||
class_methods do
|
||||
@@ -60,6 +60,10 @@ module Search::Record::Trilogy
|
||||
self.content = Search::Stemmer.stem(content) if content_changed?
|
||||
end
|
||||
|
||||
def set_account_key
|
||||
self.account_key = "account#{account_id}"
|
||||
end
|
||||
|
||||
def highlight(text, show:)
|
||||
if text.present? && attribute?(:query)
|
||||
highlighter = Search::Highlighter.new(query)
|
||||
|
||||
Generated
-15
@@ -408,21 +408,6 @@ ActiveRecord::Schema[8.2].define(version: 2025_11_21_112416) do
|
||||
t.index ["user_id"], name: "index_search_queries_on_user_id"
|
||||
end
|
||||
|
||||
create_table "search_records", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.uuid "account_id", null: false
|
||||
t.string "account_key", null: false
|
||||
t.uuid "board_id", null: false
|
||||
t.uuid "card_id", null: false
|
||||
t.text "content"
|
||||
t.datetime "created_at", null: false
|
||||
t.uuid "searchable_id", null: false
|
||||
t.string "searchable_type", null: false
|
||||
t.string "title"
|
||||
t.index ["account_id"], name: "index_search_records_on_account_id"
|
||||
t.index ["account_key", "content", "title"], name: "index_search_records_on_account_key_and_content_and_title", type: :fulltext
|
||||
t.index ["searchable_type", "searchable_id"], name: "index_search_records_on_searchable_type_and_searchable_id", unique: true
|
||||
end
|
||||
|
||||
create_table "search_records_0", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.uuid "account_id", null: false
|
||||
t.string "account_key", default: "", null: false
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.2].define(version: 2025_11_20_203100) do
|
||||
ActiveRecord::Schema[8.2].define(version: 2025_11_21_112416) do
|
||||
create_table "accesses", id: :uuid, force: :cascade do |t|
|
||||
t.datetime "accessed_at"
|
||||
t.uuid "account_id", null: false
|
||||
|
||||
Reference in New Issue
Block a user