Try this one…
import wixData from 'wix-data';
$w.onReady(() => {
let dataset="#dataset6";
let numPhotos;
let totalPhotos
$w(dataset).onReady(()=>{
$w("#buttonSearch").onClick((event)=>{console.log('button clicked');
totalPhotos=$w(dataset).getTotalCount();
console.log('Total photos:' + totalPhotos);
let phototitle=$w('#inputTitle').value;
const searchFilter=wixData.filter().contains("Title", phototitle);
$w(dataset).setFilter(searchFilter);
console.log('filtering dataset by title:' + phototitle)
console.log('Total photos matching title search:' + totalPhotos);
});
});
});
If my suggestion do not work, you will find and alternative solution here…