I have a table like so.
ALTER TABLE clients ADD tsv tsvector;
CREATE INDEX index_clients_on_tsv
ON clients
USING gin (tsv);
CREATE TRIGGER clientstsvectorupdate BEFORE INSERT OR UPDATE
ON clients FOR EACH ROW EXECUTE PROCEDURE
tsvector_update_trigger(
tsv, 'pg_catalog.english', first_name, middle_name, last_name, email, birthday_string
);
But then I noticed that fuzzy searching was not working: "Chris", would not look up "Christopher". I did a little digging and found gin_trgm_ops
Naturally the first thing I tried to do was update the index via
CREATE INDEX index_clients_on_tsv
ON clients
USING gin (tsv gin_trgm_ops);
But now I see an error relating to the fact I'm passing a tsvector
to gin_trgm_ops
.
(Postgrex.Error) ERROR 42804 (datatype_mismatch): operator class "gin_trgm_ops" does not accept data type tsvector
What is the best way to address what I'm trying to implement?