OR Filter Is Not Working

I have search function with the code below.
Filter.or function is not working and throwing error ’ WDE0049: Invalid .or parameter [Object]. .or expects FilterBuilder only.’
Any help ?
Thanks.

if (keywords) {
filter = filter.contains( “title” , keywords);
filter = filter.or(wixData.query( “MPP-Edu-Schools” ).hasSome( “searchKeywords” , keywords));
filter = filter.or(wixData.query( “MPP-Edu-Schools” ).hasSome( “subCategoriesTags” , keywords));
}

if (city)

{ 

if (city && city !== “Other” )
filter = filter.eq( ‘city’ , city);

if (city && city === “Other” ) {
filter = filter.ne( ‘city’ , “xxx” );
filter = filter.ne( ‘city’ , “yyy” );
filter = filter.ne( ‘city’ , “zzz” );

    } 
} 

await $w( “#dsSchools” ).setFilter(filter)

You can’t put wixData.query in a dataset filer

Like J.D. already said, you get problems when trying to mix DATA-results with DATASET-filter.

To solve your problem, try this one…

let DATABASE = "Here_Your_Collection"
let REFERENCE = "Here_Your_Referencefield"
let item = "Here_Your_Item"
let uniqueItems = []
let myFilter=[]

CB1 = $w('#myCheckboxGroup1').value

 for (var i = 0; a < CB1.length; a++) {
    wixData.query(DATABASE)
    .eq(REFERENCE, CB1[a])
    .find()
    .then(async res => {  
        for (var i = 0; i < res.items.length; i++) {
             let ITEM = await res.items[i]
             let ID = await res.items[i]._id
             console.log("ITEM = ",ITEM)
             console.log("ID = ",ID)
             
             if(myFilter.includes(ID)) {console.log("TRUE")}
             else {console.log("FALSE")
                myFilter.push(ID), 
                await uniqueItems.push(ITEM)}
             }
             console.log("myFilter= ", myFilter)
             console.log("Unique-Items = " , uniqueItems)
        }
    })
}    

This should give back, all unique items. ----> [uniqueItems]

console.log(uniqueItem[0])
console.log(uniqueItem[1])
console.log(uniqueItem[2])
console.log(uniqueItem[3])
//and so on...

Code is not tested. —> Just some brainstorming!

An working example, you will be able to see soon here…[still in DEVELOPMENT]
https://www.media-junkie.com/pflegeservice

Documentation stated should use WixDataQuery when using or() with WixDataFilter

Try replacing wixData.query( “MPP-Edu-Schools” ) with wixData . filter () in your or() function