-- 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;