I have a “Places” collection. Its reference field is a smart field. I made this smart field “searchable”.
field: 'title',
type: 'String',
get: place => `${place.sergicIdFull} - ${place.displayName}`,
search: (query, search) => {
const split = search.split(' ');
const searchCondition = {
[Op.or]: [
{ 'sergic_id_full': { [Op.iLike]: `%${split[0]}%` } },
{ 'sergic_id_full': { [Op.iLike]: `%${split[1]}%` } },
{ 'display_name': { [Op.iLike]: `%${split[0]}%` } },
{ 'display_name': { [Op.iLike]: `%${split[1]}%` } },
],
};
query.where[Op.and][0][Op.or].push(searchCondition);
return query;
}
I use the smart field as a reference field for other collections. As an example :
in this picture, the reference field is on the right hand side (Places = Copropriété)
I’d like to know if it would be possible to make this column searchable as well.
For instance type “500031” and get the matching clients.