I have a Ticket model and a Comment model. The Ticket has a hasMany relationship to Comment model. I want to search tickets by a keyword. The keyword will be matched againts
const { Op } = require("sequelize"); var options = { where: { [Op.or]: [ { 'subject': { [Op.like]: '%' + query + '%' } }, { '$Comment.body$': { [Op.like]: '%' + query + '%' } } ] }, include: [{ model: Comment }] };
Op.iLike can be used for case-insensitive search.
Op.iLike