Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full text search in python #753

Open
aaa3334 opened this issue Apr 1, 2024 · 1 comment
Open

Full text search in python #753

aaa3334 opened this issue Apr 1, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@aaa3334
Copy link

aaa3334 commented Apr 1, 2024

Hi!

I am wondering if there is a way to do the full text search as described here? https://supabase.com/docs/guides/database/full-text-search?language=js&example-view=sql

Note I am fine on creating the fts column in the table I am searching, just when I am trying to do the actual search.

Note I am trying to use this:
initial_query = initial_query.filter('fts', 'plfts', keyword_query)

Where the keyword_query is either one word or a few strung together by |

If I attempt the same query in the sql in supabase itself it works, but it doesnt work if I try and use .filter and I am not sure what else to use (eg textsearch does not exist on it).

How can I get this to work?

I have considered:

  1. Perhaps there is a different way to format it so I get the actual results here that i have just missed
  2. Perhaps there is a way to send the sql statement directly? (this is in python so all in the back end)

Unsure how to get this to work

Thanks in advance!

@aaa3334 aaa3334 added the documentation Improvements or additions to documentation label Apr 1, 2024
@silentworks
Copy link
Contributor

silentworks commented Apr 10, 2024

You would perform a full text search using the .text_search method.

client.table("movies").select("*").text_search("title", "'The Aveng'").execute()

or if you want to manually use a filter you can do

client.table("movies").select("*").filter("title", "fts", "'The Aveng'").execute()

Do note the single quote around 'The Aveng' as it is necessary for the full text search to work. Also in your example you have the order incorrect, its column_name, operator and criteria that the .filter function takes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants