I could use some help filtering my autocomplete suggestions by the current facet.
I have set up a meta collection with 3 sub-collections. I have also set up a facet containing the 3 sub-collections.
When I start typing a search term, suggestions from outside the selected sub-category facet are being displayed. This seems to happen because the autocomplete keywords are not filtered by the selected facet. I found that this might be misleading to some users.
As a workaround, I tried setting the collection in the autocomplete plugin as the selected sub-category. But the category doesn't seem to update when I select a different subcategory. Here's a snippet:
$studyTypeInput.on('change', () => {
let type = $(this).find('option:selected').val();
selectedCollection = collections[type];
$searchInput.autocompletion({
datasets: {
organic: {
collection: selectedCollection,
profile : '_default',
program: 'https://mysearchhost.squiz.cloud/s/suggest.json',
format: 'extended',
alpha: '0.5',
show: '10',
sort: '0'
},
},
typeahead: {
hint: true
},
length: 3
});
}).change();