2
ALTER TABLE users ADD COLUMN full_text_vector TSVECTOR;

CREATE INDEX full_text_index ON users USING gin(full_text_vector gin_trgm_ops);

The last line is giving me the following error:

SQLSTATE[42804]: Datatype mismatch: 7 ERROR: operator class "gin_trgm_ops" does not accept data type tsvector (SQL: CREATE INDEX full_text_index ON users USING gin(full_text_vector gin_trgm_ops))

Without adding gin_trgm_ops to the last line it works, but then I can't search on possible misspellings. Is it possible to both have rankings AND misspelled words?

  • 1
    It all depends on the details of your undisclosed situation (table definition, Postgres version number, query, description). Just to make sure: you are not, by any chance, confusing full text search with trigram similarity operations? If you are not sure, consider this related answer. – Erwin Brandstetter Jul 12 '15 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.