This is a HUGE upgrade and can mark the searching nearly complete! Other than the scrolling and some other smaller UI things. The search appears to be working.
18 lines
525 B
PL/PgSQL
18 lines
525 B
PL/PgSQL
-- Author: Hayden Hargreaves (hhargreaves2006@gmail.com)
|
|
-- Desc: Create a full text index on the recipes table.
|
|
-- Date: 07/10/2025
|
|
|
|
BEGIN;
|
|
|
|
-- Update recipes table with the search vector column
|
|
ALTER TABLE Recipes
|
|
ADD search_vector tsvector GENERATED ALWAYS AS (
|
|
setweight(to_tsvector('english', coalesce(title, '')), 'A') ||
|
|
setweight(to_tsvector('english', coalesce(description, '')), 'B')
|
|
) STORED;
|
|
|
|
-- Create the search index
|
|
CREATE INDEX idx_recipe_search_vector ON recipes USING GIN (search_vector);
|
|
|
|
COMMIT;
|