Please can someone help provide the correct syntax for the request when making the full-text search query when making a REST API request?
I've been looking at the Supabase docs, and I'm sure you can perform full-text searches generally: https://supabase.com/docs/guides/database/full-text-search https://supabase.com/docs/reference/javascript/textsearch
However I'd like to perform the search by using the REST API. Here are a few examples of things I've tried so far:
https://apikey.supabase.co/rest/v1/table?field=textSearch.("query")
https://apikey.supabase.co/rest/v1/table?field=to_tsquery.("query")
https://apikey.supabase.co/rest/v1/table?select=*&to_tsquery=field.query
https://apikey.supabase.co/rest/v1/table?select=*&to_tsquery=field.query
P.S. I also attempted to use this type of format: https://github.com/supabase/supabase/discussions/1069
Any help would be much appreciated, thanks!
CodePudding user response:
Supabase uses postgREST for their REST API. You can check the postgREST documentation for this feature.
The fts filter has a number of options to support flexible textual queries, namely the choice of plain vs phrase search and the language used for stemming. Suppose that tsearch is a table with column my_tsv, of type tsvector. The following examples illustrate some possibilities:
GET /tsearch?my_tsv=fts(french).amusant HTTP/1.1
GET /tsearch?my_tsv=plfts.The Fat Cats HTTP/1.1
GET /tsearch?my_tsv=not.phfts(english).The Fat Cats HTTP/1.1
Operator | Meaning |
---|---|
fts | Full-Text Search using to_tsquery |
plfts | Full-Text Search using plainto_tsquery |
phfts | Full-Text Search using phraseto_tsquery |
wfts | Full-Text Search using websearch_to_tsquery |