Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CREATE FUNCTION comment_text_search_trigger() RETURNS trigger AS $$
begin
new.tsv_comment_text :=
setweight(to_tsvector(coalesce(new.story_title,'')), 'A') ||
setweight(to_tsvector(coalesce(new.comment_text,'')), 'B');
return new;
end
$$ LANGUAGE plpgsql;
/* Trigger on update */
CREATE TRIGGER tsvector_comment_text_update BEFORE INSERT OR UPDATE
ON comments FOR EACH ROW EXECUTE PROCEDURE comment_text_search_trigger();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.