Expected behavior
I expect that by typing some text in the top search bar (over the table)
i will be able to search by my smart field
Actual behavior
It doesn’t find anything without failure logs
Context
Smart field itself:
{
field: 'Job title',
type: 'String',
get: async ({id: disputeId}) => {
const job = await disputeService.getJob(disputeId);
return job.title;
},
search: async function (query, search) {
const ids = await disputeService.searchByJobName(search);
var searchCondition = {
[Op.or]: [
{ id: { [Op.in]: ids } },
]
};
query.where[Op.and][0][Op.or].push(searchCondition);
return query;
}
},
Service methods I use (they work but the part where I push into query object doesnt seem to work)
async searchByJobName(jobName) {
const ids = sequelize.query(`
select d.id from disputes d
join offers o on d.offer_id = o.id
join jobs j on o.job_id = j.id
where j.title ilike :s;
`, {
replacements: { s: `%${jobName}%` },
type: QueryTypes.SELECT
});
return ids;
},
async getJob(disputeId) {
const [job] = await sequelize.query(`
select d.id, j.* from disputes d
join offers o on d.offer_id = o.id
join jobs j on o.job_id = j.id
where d.id = :did;
`, {
replacements: { did: disputeId },
type: QueryTypes.SELECT
});
return job;
},