© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
Testhor

Filter from JSON with CS (contains)

I'm trying to make a small search system for my website, where it would search in some columns depending on a choice.
For example, the search can have this as parameters: search: [{f: 'titre', q: 'ilike'}, {f:'categories', q: 'contains'}],
So, with that I would like to generate a OR() query to search in every column (f) with the specified method (q),

For testing, I have a function like that in my code:
type.search.forEach((f, i) => {
if(i>0) rep += ','
if(f.q === 'ilike') rep += f.f + '.ilike.' + searchString + ''
if(f.q === 'contains') rep += f.f + ".cs.{"+ searchString + "}"
})

And this would output titre.ilike.inf,categories.cs.{inf} for example

The problem is, when I use this output in .or() of my supabase query, I always have error with the CS (bas query token...) So, I don't get how I'm suppose to make it work. Categories is an array in that case
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

REST URL Filter: Column contains value
SupabaseSSupabase / help-and-questions
3y ago
Filter using json isnt working
SupabaseSSupabase / help-and-questions
4y ago
can't fetch data from contains condition
SupabaseSSupabase / help-and-questions
3y ago
I can't filter posts by json column
SupabaseSSupabase / help-and-questions
4y ago