Search query with the help of multireference field

I am having trouble using a reference field in my query.
The Website link is https://www.shopmayven.com/ .
So the problem is I have two tables, one is Tag and other one is brands. Page name is all brands. I have a reference field of tags in the brands collection. Now I have a tag input field in the search results. I want to search brands according to the tags selected. As tags is a reference field I am not able to use in query to perform my search. So I added a new field in the Brand collection to perform my search. I can have my search results through that query but the problem is I want to use a reference field for which I have entered all the records. I can not re-enter all the data into that field.
Here is my code. And it is working but not for the reference field. Please help me that how I can use reference field into my query so I can result like that
function loadDataToRepeater ( ) {

let dataQuery = wixData . query ( collectionName )
let dataQuery1 = wixData . query ( collectionName )

if ( $w ( “#tags” ). value . length > 0 || $w ( “#checkboxGroup1” ). value . length > 0 || $w ( “#checkboxGroup2” ). value . length > 0 || $w ( “#checkboxGroup3” ). value . length > 0 ) {
//dataQuery = dataQuery.hasAll(fieldToFilterByInCollection, $w(“#tags”).value)
dataQuery1 = dataQuery . hasAll ( fieldToFilterByInCollection , $w ( “#tags” ). value . concat ( $w ( “#checkboxGroup1” ). value , $w ( “#checkboxGroup2” ). value , $w ( “#checkboxGroup3” ). value ) )
console . log ( dataQuery1 );
}

dataQuery1

. find ()
. then ( results => {
const itemsReadyForRepeater = results . items
$w ( ‘#repeater1’ ). data = itemsReadyForRepeater ;
console . log ( itemsReadyForRepeater );
const isRepeaterEmpty = itemsReadyForRepeater . length === 0

if ( isRepeaterEmpty ) {
$w ( ‘#noResultsFound’ ). show ()
} else {
$w ( ‘#noResultsFound’ ). hide ()
}
})
}