I just got the code figured out to allow users to search a database of job applications so that it kicks back the results to a string of repeaters. Now I need to be able to add a dropdown to tie this to the searchbox. Most of the options I have seen involved or statements, but I require an and statement, if that exists. I would like to have my results shown by filtering by city, and then searching by keyword. Code for the search looks like this:
import wixData from ‘wix-data’;
export function button1_click(event, $w) {
//Add your code for this event here:
wixData.query(‘Applications’)
.contains(‘name’, $w(‘#searchbox’).value)
.or(wixData.query(‘Applications’)
.contains(‘position’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘fullPartTime’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘employer1’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘employer2’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘employer3’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘position1’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘position2’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘position3’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘languages’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘skills’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘certifications’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘interests’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘whatToOffer’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘goals’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘foodServed’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘foodWantToServe’, $w(‘#searchbox’).value))
.or(wixData.query(‘Applications’)
.contains(‘sideoftown’, $w(‘#searchbox’).value))
.find()
.then(res => {
$w(‘#repeater2’).data = res.items;
$w(‘#repeater2’).show();
});
}
the dropdown would be considered #dropdown1