Search multiple collection fields with a single input field

import wixData from 'wix-data';

let debounceTimer;

 

export function search_keyPress() {

 

$w('#repeater1').expand();

 

if (debounceTimer) {

 

clearTimeout(debounceTimer);

 

debounceTimer = undefined;

 

}

 

debounceTimer = setTimeout(() => {

 

filter($w('#search').value);

 

},200);

 

 

}

 

let lastFilterSearch;

 

function filter(search) {

 

if (lastFilterSearch !== search) {

 

$w('#dataset1').setFilter(wixData.filter().contains('title', $w('#search').value)

.or(wixData.filter().contains('region', $w('#search').value))

.or(wixData.filter().contains('category', $w('#search').value))

)

}

}

 

 

// use a dataset and connect to a repeater and use invisible buttons that connect to the additional fields in order to filter