postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

textSearch() uses only English dictionary instead of 'simple' as a default

Open kvetoslavnovak opened this issue 2 years ago • 8 comments

In my Supabase collection I have created to_tsvector using 'simple' parameter dictionary as I need multi languages searching. Testis in Supabase SQL editor using to_tsquery('simple', ...) work just fine.

But using client textSearch() method gives highly incorrect results.

I believe the problem and the reason is that Supabase uses only 'english' dictionary as a hidden to_tsvector parameter for textSearch() method. Is there any way how to specify in textSearch() the dictionary language parameter? I would guess 'simple' dictionary should be the default one instead. Why this "imperial English supremacy" ?

Anyway textSearch() should accept the parameter specifying the language for to_tsvector.

kvetoslavnovak avatar Feb 17 '23 22:02 kvetoslavnovak

Anyway textSearch() should accept the parameter specifying the language for to_tsvector.

See https://supabase.com/docs/reference/javascript/textsearch, you can set the dictionary in the config param.

const { data, error } = await supabase .from('quotes') .select('catchphrase') .textSearch('catchphrase', 'fat' & 'cat', { config: 'english' })

steve-chavez avatar Feb 18 '23 05:02 steve-chavez

Thanks @kvetoslavnovak, in hindsight we should default to 'simple' instead - we'll make the change on the next major version of the library.

soedirgo avatar Feb 21 '23 09:02 soedirgo

Thank you very much @soedirgo . And big thank to @steve-chavez for the tip.

kvetoslavnovak avatar Apr 23 '23 15:04 kvetoslavnovak

default to 'simple' is merged or is still use 'english' as default?

siisee11 avatar Oct 19 '23 07:10 siisee11