admin管理员组文章数量:1399911
I've tried using many symbols to separate columns; ||, |, &&, & with and without spaces.
For instance
.textSearch("username, title, description", "...");
.textSearch("username|title|description", "...");
And nothing has worked :(
I've tried using many symbols to separate columns; ||, |, &&, & with and without spaces.
For instance
.textSearch("username, title, description", "...");
.textSearch("username|title|description", "...");
And nothing has worked :(
Share Improve this question edited Sep 17, 2021 at 14:55 Lunandd asked Sep 17, 2021 at 14:48 LunanddLunandd 551 silver badge6 bronze badges1 Answer
Reset to default 7You could create a SQL function to perform search like this:
create or replace function search_posts(keyword text)
returns setof posts
as
$func$
select
*
from
posts
where
to_tsvector(username || ' ' || title || ' ' || description) -- concat columns, but be sure to include a space to separate them!
@@ to_tsquery(keyword);
$func$
language sql;
You can call this function like this:
const {data, error} = await supabase.rpc('search_posts', { keyword: '[YOUR_SEARCH_TERM_HERE]' })
You can read more about textSearch here
本文标签:
版权声明:本文标题:typescript - Is there a way to perform full text search on multiple columns on Supabase with Javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744240677a2596773.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论