I'm pretty new to Supabase and Postgresql as a whole. I'm attempting to add some sort of fuzzy searching ability within a table for example a list of tags that might include "Business" should be returned for a query of "Bus" or "Busness".
I have enabled the FUZZYSTRMATCH extension but can't figure out how to query in the Javascript client lib. I currently have this but it's only matching the whole word.
supabase
.from('tags')
.select()
.limit(10)
.order('tag', {ascending: true})
.textSearch('tag', `'${query}'`)
.then(({data, error}) => {
if (error) {
reject(error);
} else {
resolve(data);
}
});
If you want to match against part of a word or a sentence, you might want to use the ilike filter offered by Supabase.
const { data, error } = await supabase
.from('tags')
.select()
.ilike('tag', `${query}%`)