Problem with delay when searching gallery using filters

I’m creating a website for an archive project in my local area which needs multiple media types (photographic, audio, video etc.).

I’m aware I can’t put video into the #database and have it appear in the gallery so I was going to use a thumbnail that linked to a video link as a work around. If there is a way I’d love to know!

To add, you have to press enter to get the gallery to refresh the content after a query (I’d prefer it to automatically search after waiting 0.5-1s.

Also, when I manage to have a lot of items, load more works for one more section of images but not any further than that.


import wixData from "wix-data";

$w.onReady(function () {

});

let debounceTimer;
export function search_keyPress(event, $w) {
 if (debounceTimer) {
        clearTimeout(debounceTimer);
        debounceTimer = undefined;
    }
    debounceTimer = setTimeout(() => {}, 150);

 let searchValue = $w("#search").value;

    $w('#dynamicDataset').setFilter(wixData.filter().contains('title', searchValue)
    .or(wixData.filter().contains('description', searchValue)
    .or(wixData.filter().contains('year', searchValue)
    .or(wixData.filter().contains('author', searchValue)
    .or(wixData.filter().contains('tags', searchValue))))));
}
    

I’m not super experienced with code but I followed a tutorial on YouTube to get the gallery all linked and up and running. It works but only partially. Any help would be very appreciated! TIA

For starters place your imports line above the pages onReady function.

See here for more info.
https://www.wix.com/corvid/reference/$w.html#onReady

Thanks for the tip!