need help with my multi filter search bar

Hello community,

I modified a code to allow me to filter the results through radioGroup and a search bar.
It works perfectly but when I write a word in my search bar, it only shows me the accuracy of the word.

If this word is part of a sentence or if it has a capital letter it does not appear in the results.
How can I fix this problem?

I thank you in advance


My Code :

import wixData from ‘wix-data’;
$w.onReady(() => {

$w('#dataset1').onReady(() => { 

var filter1 = wixData.filter()
//var filter2 = wixData.filter().eq(‘rubrique’, ‘’)

    filter1.filterTree.$and[0] = {} 
    filter1.filterTree.$and[1] = {} 
    filter1.filterTree.$and[2] = {} 

    $w('#radioGroup1').onChange(() => { 

let rubrique = $w(‘#radioGroup1’).value;
if (rubrique === ‘rubrique’) {

            filter1.filterTree.$and[0] = {} 
        } else { 

            filter1.filterTree.$and[0] = { 

‘rubrique’: rubrique
}
}
})

    $w('#input1').onChange(() => { 

let titreDeLAnnonce = $w(‘#input1’).value;
if (titreDeLAnnonce === ‘titreDeLAnnonce’) {
filter1.filterTree.$and[1] = {}

        } else { 
            filter1.filterTree.$and[1] = { 

‘titreDeLAnnonce’: titreDeLAnnonce
}
}
})

    $w('#radioGroup2').onChange(() => { 

let Pro = $w(‘#radioGroup2’).value;

if (Pro === ‘proffesionnel’) {
filter1.filterTree.$and[2] = {}
} else {

            filter1.filterTree.$and[2] = { 

‘proffesionnel’: Pro
}
}
})

    $w('#button6').onClick(() => { 

        filter(); 

    }) 

    $w('#boutonreset').onClick(() => { 

        $w('#radioGroup1').value = "" 

        $w('#input1').value = "" 

        $w('#radioGroup2').value = '' 

       filter1.filterTree.$and[0] = {} 

        filter1.filterTree.$and[1] = {} 

        filter1.filterTree.$and[2] = {} 

        $w('#dataset1').setFilter(wixData.filter()); 

    }) 

function filter() {

        console.log(filter1.filterTree.$and) 

        $w('#dataset1').setFilter(filter1) 

    } 
}) 

})

your using .eq which essentially means it has to be an exact match.

you should be using .contains which means if any of the text is found it will return a result.

@Mike Moynihan

Thank you for your return but I’m bad I do not see how to incorporate .contains in my code you can help me.

my bad i see now you have // that part of the code