S
Supabase2y ago
Bod

Full Text Search

Hello, I'm trying to do a full text search on my table but I can't make it work withous exact matches. Here is a screenshot of my table : I tried in js and directly in the SQL Editor
data = await client
.from("sneakers")
.select()
.textSearch("name", query, {
type: "websearch",
config: "english",
})
.range(
page * items_per_page - items_per_page,
page * items_per_page - 1
);
data = await client
.from("sneakers")
.select()
.textSearch("name", query, {
type: "websearch",
config: "english",
})
.range(
page * items_per_page - items_per_page,
page * items_per_page - 1
);
select
*
from
sneakers
where
to_tsvector(name) @@ to_tsquery('jor');
select
*
from
sneakers
where
to_tsvector(name) @@ to_tsquery('jor');
neither of them return rows. What am I doing wrong ?
No description
1 Reply
garyaustin
garyaustin2y ago
Text search does not work well for partials. You would have to turn to ilike or pg_trgrm. It has ability to handle “prefixes” by doing jor* but the results are not robust. This is a widely commented on topic for Postgres on the web. There should be lots of info out there.

Did you find this page helpful?