How to use .or() filter with joined table columns in Supabase?
Hey everyone! I'm trying to search across both a main table column and a joined table column using .or(), but I keep getting a parse error.
What I'm trying to do:
Search for jobs by either job title OR company name (from joined table)
My code:
typescriptlet query = supabase.from("jobs").select(
  *,
  company:companies!inner(id, name)
, { count: "exact" });
// This fails with parse error
query = query.or(title.ilike.%${searchTerm}%,companies.name.ilike.%${searchTerm}%);
"failed to parse logic tree ((title.ilike.%air%,companies.name.ilike.%air%))"
What I've tried:
Using company.name (the alias) - doesn't work
Using companies.name (the table name) - doesn't work
Using just .ilike() twice creates an AND condition, not OR
Question:
Is it possible to use .or() to filter on joined table columns? If not, what's the recommended approach for "search by title OR company name" functionality?
Thanks in advance!0 Replies