Smart Field Search

I can’t get async search for a smart field.

The code below worked well.

search: async (query, search) => {
        const searchCondition = { id: 11 };
        query.where[Sequelize.Op.and][0][Sequelize.Op.or].push(searchCondition);
        return query;
}

But it didn’t work for me when I added the code for delaying.

search: async (query, search) => {
        await new Promise(resolve => {
          setTimeout(resolve, 10);
        });

        const searchCondition = { id: 11 };
        query.where[Sequelize.Op.and][0][Sequelize.Op.or].push(searchCondition);
        return query;
}

Hi @Jose_Vargas welcom to our community :wave: and thank you to use Forest Admin.
I don’t know what do you want to do, but have a look on this documentation https://docs.forestadmin.com/woodshop/how-tos/search-on-a-smart-field-with-joints, maybe should be help.
Let me know.

Thank you for your help @Arnaud_Moncel.

I saw that search supports a promise as a result in the documentation (https://docs.forestadmin.com/documentation/reference-guide/fields/create-and-manage-smart-fields) and just wanted to do some extra works in the search, but it didn’t work for me.

But search-on-a-smart-field-with-joints works for me now.

Thank you!

Hi @Jose_Vargas,

This was a misleading information :face_with_hand_over_mouth:, the documentation has been fixed ≈30 minutes ago thanks to your feedback! :pray: