fuzzy search in supabase

Viewed 108

IS there a way we can do fuzzy matching in Supabase Table. I am looking to find match between words like "cherly" and "cher!y". I tried fts, plfts, phfts and wfts but none of them do partial matching.

Is there a way to do fuzzy matching in Supabase?

1 Answers

Check out these extensions:

In your case you might want the levenshtein function (fuzzystrmatch) which would detect that there is only 1 character difference

SELECT levenshtein('cherly', 'cher!y');

result

| levenshtein |
| ----------- |
| 1           |

You can mix & match functions, wrap them up into an Postgres Function, then call them as an RPC (https://supabase.com/docs/reference/javascript/rpc)

Related