I’m trying to do a search by title and by content, but it gives an error
Typeorm
select
p.*,
from post p
left join vote v on p.id = v.post_id and v.user_id = $1
where p.is_published = true AND p.title ilike OR p.context::text ilike $2
limit 5 offset $3
const posts = await AppDataSource.query(`
select
p.*,
from post p
left join vote v on p.id = v.post_id and v.user_id = $1
where p.is_published = true AND p.title ilike OR p.context::text ilike $2
limit 5 offset $3
`, [req.user.id, `%${req.query.q}%`, req.query.skip]
)
>Solution :
There’s a matching pattern missing:
p.title ilike OR p.context::text ilike $2
^ HERE