Search in a reference field which is a smart field

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.

Hello @JeremyV,

Thank you for sharing this.

I think using “Extended Search” by default could help in this case.

Could you please try to modify your routes as stated in this Woodshop exemple?

Please bear in mind that this may impact overall performance as computing the smart fields will take time.

Hope this helps.