ALTER TABLE knowledge_entities ADD COLUMN IF NOT EXISTS search tsvector
  GENERATED ALWAYS AS (to_tsvector('english', COALESCE(title, '') || ' ' || COALESCE(content, ''))) STORED;

CREATE INDEX IF NOT EXISTS idx_knowledge_search ON knowledge_entities USING GIN(search);