To find out in the repeater to find out with which word the filtered data for the searched words is filtered

Hi; I have a search page that searches from the database.

the feature I want to add;

  • to show which word comes from the repeater (multiple words) for the searched words

for example;
searched words; construction and electrical works

1- construction building repair ------ contains the word: construction
2- construction and electricity ------ contains the word: construction, electricity
3- electrical works and repair ------ contains the word: electricity, works

my current search page code (How do I add the feature I mentioned? I would be glad if you can share an example on this subject.)

import wixData from ‘wix-data’ ;
export function searchButton_onClick(event) {
let searchValue = $w( ‘#SearchBox’ ).value;
let searchWords = searchValue.split( ’ ’ );
let query = wixData.query( ‘SouthAfrica’ )
.contains( ‘overview’ , searchWords[ 0 ]);

for ( let i= 1 ; i < searchWords.length; i++) {
query = query.or(wixData.query( ‘SouthAfrica’ )
.contains( ‘overview’ , searchWords[i]));
}

query.find()
.then(res => {
$w( ‘#resultsTable’ ).rows = res.items;
});
}

#search #filter # multiple #words # searchWords #query #searchValue

Hi,

You have already posted this question and have a thread about it here .

There is no need to post the same thing multiple times as it can effect the responsiveness of other users and Corvid experts alike

We have posted examples of how to update your code there. Please reply on that thread if you have any further questions.

Thank you !

Dara | Corvid Team