Hello friends, I am currently trying to search multiple databases at once. I have these lines of code, for an advanced search; just wondering how I would go about adding multiple databases to search, and populate a repeater.
import wixData from 'wix-data';
$w.onReady(function() {
});
let debounceTimer;
export function searchBar_keyPress(event) {
$w("#loadingGIF").show();
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
$w("#componentsPrimary").setFilter(wixData.filter().contains("title", $w('#searchBar').value)
.or(wixData.filter().contains("componentDescription", $w('#searchBar').value)
.or(wixData.filter().contains('parentalAsset', $w('#searchBar').value))
.or(wixData.filter().contains('componentNotes', $w('#searchBar').value))))
.then(() => {
count();
})
}, 200);
}
function count() {
let total = $w('#componentsPrimary').getTotalCount();
if (total > 1) {
$w('#resultsBar').text = `${total} results were found.`;
$w("#loadingGIF").hide();
$w('#resultsBar').show();
}
if (total === 1) {
$w('#resultsBar').text = `${total} result was found.`;
$w("#loadingGIF").hide();
$w('#resultsBar').show();
}
if (total === 0) {
$w('#resultsBar').text = "No result found!";
$w("#loadingGIF").hide();
$w('#resultsBar').show();
}
}
Hmmmm, a new idea for my tool 😏