How to search/filter either referenced field or regular field?

@tsuyoidesigns Thank you for responding! Please bear with me as I’m kinda new to this. I’ve read through the documentation but I still can’t wrap my head around it. I honestly don’t know where I will insert the .or().

Basically, I want to have my search function use either of these two queries/filters.
//This is the code for searching/filtering the referenced field(the _id of the client)

wixData.query("Clients")
    .contains("clientName",$w('#searchBar').value)
    .find()
    .then((results)=>{
        if(results.items.length>0){
            letfirstItem=results.items[0];
            filter1=firstItem._id;  
            $w("#dynamicDataset").setFilter(wixData.filter()
            .eq("clientName",filter1));                           

//This is the code for searching the regular field(companyName)

wixData.query("Companies")
    .contains("companyName",$w('#searchBar').value)
    .find()
    .then((results)=>{
        if(results.items.length>0){
            letfirstItem=results.items[0];
            filter2=firstItem.companyName;  
            $w("#dynamicDataset").setFilter(wixData.filter()
            .eq("companyName",filter2));