Skip to content

Instantly share code, notes, and snippets.

@montanalow
Created February 4, 2021 00:27
Show Gist options
  • Save montanalow/982cd01a8025fda40c2813066e2bcf9a to your computer and use it in GitHub Desktop.
Save montanalow/982cd01a8025fda40c2813066e2bcf9a to your computer and use it in GitHub Desktop.
ALTER TABLE products
ADD COLUMN keywords tsvector -- the text search indexable data type
GENERATE ALWAYS AS (
set_weight(to_tsvector(name), 'A') ||
set_weight(to_tsvector(description), 'B')
) STORED;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment