Not a Function Error. What am I doing wrong?

I really need an answer! I used to have dropdown for this and the filters worked fine. I’ve done a bunch of on click search buttons too. What I am trying to do is filter the CC_Business_Directory database by the value in the search input. I am also trying to get a count because I’d like the text component to tell the user how many results were found. This part of the code is causing issues.

if (!itemData.email) {
                $item("#email1").hide();
            } else {
                $item("#email").link = 'mailto:' + itemData.email;
                $item("#email1").show();
            }
 if (!itemData.phone) {
                $item("#phone1").hide();
            } else {
                $item("#phone").link = 'tel:' + itemData.phone;
                $item("#phone1").show();
            }
 if (!itemData.website) {
                $item("#web1").hide();
            } else {
                $item("#web").link = itemData.website;
                $item("#web1").show();
            }

 if (!itemData.category) {
                $item("#cata").hide();
                $item("#cata1").hide();
            } else {
                $item("#cata").show();
                $item("#cata1").show();
            }
          $item("#address").link = 'https://google.com/maps/place/'+ encodeURIComponent(((itemData.businessAddress.formatted)));
 if (itemData.businessAddress.string) {
                $item("#address").hide();
                $item("#address1").hide();
            } else {
                $item("#address").show();
                $item("#address1").show();

It is the oldest part of my code and I have literally carried it over from the first version of this site 3 years on. The error that is coming up is

 //-------------Imports-------------//
import wixData from 'wix-data';
export function businessNameSearch_keyPress(event) {
    $w('#textCount').expand();
    $w('#textCount').text = "Searching";
    $w('#repeater2').expand();
 
//-------------Search------------//
    wixData.query("CC_Business_Directory")
        .contains("businessName", $w('#businessNameSearch').value)
        .limit(20)
        .find()
        .then((results, num) => {
        $w("#repeater2").data = results.items;
 /-------------Listing Buttons------------//
        $w("#repeater2").onItemReady(($item, itemData, index) => {
        $item("#cata1").text = itemData.category;
        $item("#businessName").text = itemData.businessName;
        $item("#addressText").text = itemData.businessAddress.formatted;
 if (!itemData.email) {
                $item("#email1").hide();
            } else {
                $item("#email").link = 'mailto:' + itemData.email;
                $item("#email1").show();
            }
 if (!itemData.phone) {
                $item("#phone1").hide();
            } else {
                $item("#phone").link = 'tel:' + itemData.phone;
                $item("#phone1").show();
            }
 if (!itemData.website) {
                $item("#web1").hide();
            } else {
                $item("#web").link = itemData.website;
                $item("#web1").show();
            }

 if (!itemData.category) {
                $item("#cata").hide();
                $item("#cata1").hide();
            } else {
                $item("#cata").show();
                $item("#cata1").show();
            }
          $item("#address").link = 'https://google.com/maps/place/'+ encodeURIComponent(((itemData.businessAddress.formatted)));
 if (itemData.businessAddress.string) {
                $item("#address").hide();
                $item("#address1").hide();
            } else {
                $item("#address").show();
                $item("#address1").show();
            }
 
          });
 let numberOfItems = num;
 if(results.items.length > 0) {
            $w('#textCount').text = `${num} results found!`;
            $w("#loadmore1").collapse(); //This is your GIF or animated image
            }
 if(results.items.length > 12) {
            $w('#textCount').text = `${num} results found!`;
            $w("#loadmore1").collapse(); //This is your GIF or animated image
            $w("#loadmore2").expand(); //This is your GIF or animated image
            console.log("Done loading more data");
            }
 else { 
                $w("#loadmore1").collapse(); //This is your GIF or animated image
                $w('#repeater2').collapse();
                $w('#textCount').text = "No results found!";
        }
        })
         .catch( (err) => {
 let errorMsg = err;
                            });
}
//-------------Clear------------//
        $w('#clear').onClick(() => {
            $w('#businessNameSearch').value = undefined;
            $w("#loadmore1").collapse();  //This is your GIF or animated image
            $w('#repeater2').collapse()//This is your dataset
            $w('#dataset1').setFilter(wixData.filter())
            .then(() => {
            $w('#textCount').collapse();
            $w("#loadmore1").collapse(); //This is your GIF or animated image
            $w('#repeater2').collapse();
            })
            $w('#textCount').expand();
            $w('#textCount').text = "Resetting";
            console.log("Done Resetting");
            $w('#textCount').collapse();
        });

URL: https://www.sleepyhollowtarrytownchamber.com/business-directory-search?siteRevision=1319

If anyone has thoughts on order or anything to simplify any help would be amazing!!!