Filtering Database by selection tags AND search feature

Hmm might be a bit beyond me in terms of swapping to a search field. Will probably stick to selection tags only.

Is there code so that when you select another tag two aren’t selectedfor the bottom code?

import wixData from ‘wix-data’;
export function STAG1_change(event) {
let selectedTags = $w(“#STAG1”).value;
let filter = wixData.filter();
if (selectedTags) {
filter = filter.hasAll(“category”, selectedTags);
}
$w(‘#dataset1’).setFilter(filter);
}

Thanks kindly