Hope you didn’t mind, the reason I liked the code for your site you referenced is because it looked like you had a functioning next page feature for it. I’ve used the generic code before and couldn’t tie in a working prev page and next page, meaning if I set limit to 5 and have 15 results, when I hit next page button it was no longer part of the 15 query results but just random results. I’ve read the reference stuff before but seems very generic and poor in practicality for specific examples.
The code you fixed for me didn’t work, no errors but didn’t filter anything. I suspected it was missing a #repeater1 results.items function so I added it along with a limit function but it’s still not filtering. You’ve been a tremendous help I appreciate it.
import wixData from ‘wix-data’;
let lastFiltersearch
let debounceTimer
$w.onReady( function () {
//TODO: write your page related code here…
});
function update() {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#searchBar’).value);
}, 200)
}
export function searchBox_keyPress(event, $w) {
update()
}
function filter(search) {
let totalResults = 5 // displays total of 5 rather then 50 default
if (lastFiltersearch !== search) {
wixData.query(‘CATegory’)
.contains(‘search’, search)
.or(
wixData.query(‘CATegory’)
.contains(‘caTegory’, search)
)
.or(
wixData.query(‘CATegory’)
.contains(‘mOrF’, search)
)
.or(
wixData.query(‘CATegory’)
.contains(‘county’, search)
)
.limit(totalResults)
.find()
.then((results) => {
//the results are in filterData.items
$w(‘repeater1’).data = results.items;
})
. catch ((err) => {
console.log(err);
})
}
}