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

"simple" textSearch config not working as expected

Open Tsunetsuki opened this issue 1 year ago • 6 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

With textSearch, I cannot find a way to search for stopwords like and or the. This is expected when using the default english text config since this will filter stopwords, but when using the simple textSearch config the behaviour should be to get search results for any words entered.

To Reproduce

For a given table tbl with a text column col:

const textSearchText = "and";
const { data } = await supabase
  .from(tbl)
  .select()
  .textSearch(col, textSearchText, {
    type: "websearch",
    config: "simple",
  });

Expected behavior

Get rows where col contains the string "and".

Actual behavior

No results.

System information

  • OS: [Android (React Native)]
  • Version of supabase-js: [2.39.3]
  • Version of Node.js: [22.1.0]

Additional context

I would expect the above code to yield the same results as this SQL:

SELECT *
FROM tbl
WHERE to_tsvector('simple', col) @@ to_tsquery('simple', 'and');

Tsunetsuki avatar Nov 15 '24 05:11 Tsunetsuki