Filter dataset by an array of strings or Multiple reference fields

I have a collection of different activities such as swing classes, book club, meditation etc…
A repeater shows this different activities and I want to be able to filter it.

Each activity has some key words related to it for example “dance and music, exciting, outdoors”(this is one string in a text field of the collection)

I want to be able to filter these activities by an array of strings that can or cannot be found in the text field of the collection. (this array of strings comes from checkboxes that can be checked or unchecked and which values are pushed into this array)

For example
Activity “yoga” keywords “quiet, outdoors, relaxing”
Activity “swing” keywords “dance and music, exciting, outdoors”…

FilterArray1 = [“outdoors”, “quiet”]

results would be item “yoga”

FilterArray2 =[“outdoors”]

results would be both items “yoga” and “swing”

Thank you very much for your help. As you will probably notice I am new to coding so this might have a very simple classic javascript solution… If someone could tell me which steps I have to follow to find this solution it would be of great help. Thanks!


I also tried doing this with multiple reference fields so either solution would be fine! Thank you

hey did u find a solution i want to search multiple array of strings in a single field in the database

please help me I will send you some failed code if you figured it out please tell me

first code:
export function searchbar_keyPress(event, $w) {
let searchValue = $w(’ #searchbar ‘).value;
let searchWords = searchValue.split(’ ');

let wordone = searchWords[0]
let wordtwo = searchWords[1]

let allwords = wordone.and(wordtwo);

let Filter = $w(’ #dataset1 ').setFilter(wixData.filter().contains(‘name’, allwords));
}

the problem is the “and” i try to use to combine words and then use to filter. i can’t find a way to make it work. is their a way to combine them inside the contain

second code:
export function searchbar_keyPress(event, $w) {

let searchValue = $w(’ #searchbar ‘).value;
let searchWords = searchValue.split(’ ‘);
let Filter = $w(’ #dataset1 ').setFilter(wixData.filter().contains(‘name’, searchWords[0]));

for (let i=1; i < searchWords.length; i++) {
Filter = Filter.and($w(‘#dataset1’).setFilter(wixData.filter()
.contains(‘name’, searchWords[i])))
}

}
I dont think this actual loop works for filter only for query i dont know how to create one for filter where the searched sentence is split into words then tell the filter that the string in database has to have all the words searched