Hi, I would like to know how to code a search function that only shows a specific number. Lets say I type 45 and i have a number that is 145 also, then i don’t want 145 to show up. So I want to know how to bypass the 1 number before and if I have a “comma ,” before that also need to be bypassed when searched. This is my website running with the search function:
https://www.coinmasterheaven.com/cards
I have this code running at the moment:
export function searchButton_onClick(event) {
wixData.query(‘allcoinmastercardslist’)
.contains(‘villageLevel’, $w(‘#iTitle’).value)
.or(wixData.query(‘allcoinmastercardslist’).contains(‘title’, $w(‘#iTitle’).value))
.find()
.then(res=> {
$w(‘#table1’).rows = res.items;
});
}
Any help is appreciated 
You’ll want to utilize the .eq() function.
Instead of .contains(‘villageLevel’, $w(’ #iTitle ').value)
try
.eq(‘villageLevel’, $w(’ #iTitle ').value)
Hi keith, thank you for the answer. it seems to work when their are no comma(,) before. But most of the text has a comma before so they will not show up. possible i could add a blank space between but then the list will get longer and i like the design of the text.
Is there any way to bypass the comma as not visible for the search?
A possible work around would be to add more or() functions to the query.
export function searchButton_onClick(event) {
wixData.query(‘allcoinmastercardslist’)
.eq(‘villageLevel’, $w(’ #iTitle ‘).value)
.or(wixData.query(‘allcoinmastercardslist’).contains(‘title’, $w(’ #iTitle ‘).value))
.or(wixData.query(‘allcoinmastercardslist’).eq(‘villageLevel’, “,” + $w(’ #iTitle ‘).value))
.or(wixData.query(‘allcoinmastercardslist’).eq(‘villageLevel’, $w(’ #iTitle ‘).value + “,” ))
.find()
.then (res=> {
$w(’ #table1 ').rows = res.items;
}); }
Im not sure if wix will allow multiple uses of the or() function though. If it doesn’t, let me know and I’ll try something else.
Do not work unfortunately, nothing shows with that code 
But thank you!
Okay I’ve tried something a little different using the and() function that can combine two queries.
export function searchButton_onClick(event) {
let firstQuery = wixData.query(“allcoinmastercardslist”)
.eq(‘villageLevel’, $w(‘#iTitle’).value)
.or(
wixData.query(‘allcoinmastercardslist’)
.contains(‘title’, $w(‘#iTitle’).value)
);
let commaAfterValue = $w(‘#iTitle’).value + “,”;
let commaBeforeValue = “,” + $w(‘#iTitle’).value;
let secondQuery = wixData.query(“allcoinmastercardslist”)
.eq(‘villageLevel’, commaAfterValue)
.or(wixData.query(‘allcoinmastercardslist’)
.eq(‘villageLevel’, commaBeforeValue)
);
firstQuery.and(secondQuery)
.find()
.then (res=> {
$w(‘#table1’).rows = res.items;
}); }
Still not working 
seems to be a really tricky coding this one but there must be a way to do it somehow.