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