I'm using postgresql to Full Text Search and I am finding that users will not receive results if there are misspellings.I want to use fuzzy search and full text search together.For example I could not combine Trigram indexes and full text search.
What is the best way to handle misspelt words in Postgres full text search?
I'd suggest that you either use full-text search or trigram similarity matching, but don't try to mix them.
Based on the requirement, I would say that trigram similarity matching is the better fit.
If you don't get a result using the similarity operator %
, you have two choices:
Lower the similarity threshold pg_trgm.similarity_threshold
.
Query in a different way so that you get the best matches, however „distant” they are:
SELECT * FROM product ORDER BY katadi <-> ' pen' LIMIT 10;
I think that would be the better solution.