Format
This commit is contained in:
@@ -19,7 +19,7 @@ module Card::Searchable
|
||||
private
|
||||
# TODO: Temporary until we stabilize the search API
|
||||
def title_and_description
|
||||
[title, description.to_plain_text].join(" ")
|
||||
[ title, description.to_plain_text ].join(" ")
|
||||
end
|
||||
|
||||
def search_embedding_content
|
||||
|
||||
@@ -59,9 +59,9 @@ module Searchable
|
||||
|
||||
private
|
||||
def create_in_search_index
|
||||
fields_sql = ["rowid", *search_fields].join(", ")
|
||||
placeholders = (["?"] * (search_fields.size + 1)).join(", ")
|
||||
values = [id, *search_values]
|
||||
fields_sql = [ "rowid", *search_fields ].join(", ")
|
||||
placeholders = ([ "?" ] * (search_fields.size + 1)).join(", ")
|
||||
values = [ id, *search_values ]
|
||||
|
||||
execute_sql_with_binds(
|
||||
"insert into #{search_table}(#{fields_sql}) values (#{placeholders})",
|
||||
@@ -72,7 +72,7 @@ module Searchable
|
||||
def update_in_search_index
|
||||
transaction do
|
||||
set_clause = search_fields.map { |field| "#{field} = ?" }.join(", ")
|
||||
binds = search_values + [id]
|
||||
binds = search_values + [ id ]
|
||||
|
||||
updated = execute_sql_with_binds(
|
||||
"update #{search_table} set #{set_clause} where rowid = ?",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class AddDescriptionToCardsSearchIndex < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
drop_virtual_table :cards_search_index, "fts5", ["title"]
|
||||
create_virtual_table :cards_search_index, "fts5", ["title", "description"]
|
||||
drop_virtual_table :cards_search_index, "fts5", [ "title" ]
|
||||
create_virtual_table :cards_search_index, "fts5", [ "title", "description" ]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user