'Search api prisma mysql where ANY

I'm trying to implement search api for my project. However I'm not sure how to accomplish this task whenever I got many variables which need to be included into query. For example how can I search for ANY character using this piece of code?

jobs = await prisma.jobOffer.findMany({
            where: {
                OR: [
                    {
                        title: {
                            search: searchTerm?.replace(' ', ' | ') || undefined
                        }
                    },
                    {
                        description: {
                            search: searchTerm?.replace(' ', ' | ') || undefined
                        }
                    }
                ]
            },
            include: {
                category: true,
                company: true
            }
        })

UPDATE: as stated in docs, OR returns no results if undefined. On the other hand, AND returns all results if undefined, so I took this approach:

jobs = await prisma.jobOffer.findMany({
        where: {
            AND: [ 
                   {
                       OR: [
                            {
                                title: {
                                    search: searchTerm?.replace(' ', ' | ') || undefined
                                }
                            },
                            {
                                 description: {
                                          search: searchTerm?.replace(' ', ' | ') || undefined
                                 }
                            }
                        ]
                   }
                 ]
        },
        include: {
            category: true,
            company: true
        }
    })


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source