Hi everyone,
So I’m trying to create a search engine on my website - www.thedailypush.com/skatehealth-search - I have 2 search boxes - one for “speciality” and second for “location” and I have it set up so the results appear on a different page. I want the results to be filtered so the repeater only displays results that match the search terms from both boxes. So for example if someone searches “physiotherapy” in the speciality box and “USA” in the location box it will only show results that match both search terms, or if someone searches “physiotherapy” and leaves the location box blank it will display only the results that match physiotherapy. Btw I’m a complete newbie with coding.
Thank you very much for the help!
The code I have so far on the “results” page is:
import {local} from ‘wix-storage’;
import wixData from ‘wix-data’;
$w.onReady( function () {
var sameWord = local.getItem(“searchWord”);
$w(“#iTitle”).value = sameWord;
$w(“#iTitle”).placeholder = sameWord;
var sameWord2 = local.getItem(“searchWord2”);
$w(“#iLocation”).value = sameWord2;
$w(“#iLocation”).placeholder = sameWord2;
$w(‘#itemsDataset’).onReady( function () {
search();
});
});
export function iSearch_click() {
search();
}
function search() {
wixData.query(‘Items’)
.contains(“specialities”, $w(“#iTitle”).value)
.contains(“locationSearch”, $w(“#iLocation”).value)
.find()
.then(res => {
$w(‘#listRepeater’).data = res.items;
});
}