Hi,
I have a search bar for user to enter search keyword. What I'm trying to do is to use query loop so it finds the most related item in the database. Basically I add query with .and to previous query until it reaches the last keyword, and then use .find to find the results, instead of querying many times and concatenate the results. Below is my code:
$w('#keywordButtonTxt').label = $w('#keyword').value let keywordList = $w('#keyword').value.split(' '); console.log(keywordList) console.log(keywordList.length) let query; for (var i = 0; i < keywordList.length; i++) { if (i === 0) { query = wixData.query("db") .contains("title", keywordList[i]); } else { query = query.or(wixData.query("db") .contains("title", keywordList[i])) } } query.ascending("title") .limit(10) .find() .then((res) => { let data = res.items; $w('#rptDropdown').data = data; listSize = res.items.length; $w('#box2').expand(); $w('#box5').expand(); $w('#box4').expand(); $w('#box6').expand(); $w('#rptDropdown').expand(); }); break;
However, it keeps giving me "WDE0028: Request timed out." error. Does anyone know how to solve this? Thanks!