Search database to be displayed to an existing repeater, connected also to the same database

I’m trying to make a search box that can search through a database I made and display the results with its corresponding fields and details on a repeater, which also displays the said database. I put up some code and no error happened. But the search box can’t be typed into. You can’t type anything. Can you help me out?


import wixData from 'wix-data';

let lastFiltersearch
let debounceTimer

$w('#CBSbar').onKeyPress((event) => {
    update()
 function update() {
 if (debounceTimer) {
            clearTimeout(debounceTimer);
            debounceTimer = undefined;
        }
        debounceTimer = setTimeout(() => {
            filter($w("#CBSbar").value);
        }, 200);
    }

 function filter(search) {
 let totalResults = 10
 if (lastFiltersearch !== search)

            wixData.query("CBSLessons")
            .contains("title", search)
            .or(
                wixData.query("CBSLessons")
                .contains("subTitle", search)
            )
            .or(
                wixData.query("CBSLessons")
                .contains("uploadDate", search)
            )
            .or(
                wixData.query("CBSLessons")
                .contains("description", search)
            )
            .limit(totalResults)
            .find()
            .then((results) => {
                $w("#CBSbox").data = results.items;
            });
    }
});

Hey,

Can we get a link to your site, so we can see the search box and have a closer look?

What element did you use for the search box? Make sure you are using a text input element from the input section of the Editor and check the settings to make sure that it is not set to “Read Only”.

We also have a complete tutorial that explains how to set up what you are looking for which may help.

Corvid Tutorial: Adding Collection Data Search Functionality

Hope this helps!

Dara | Corvid Team