Hey there,
I am sort of stuck.
I have to build a search function in the tool Appery.io, which is normally drop n drag, but it doesn't serve the purpose in this instance. The details are:
I will post some screen's to help flesh it out-
So, in order there is a 'search input field' 'search button' 'select button' & in the background (backend REST/GET API) the Database with 6 fields that must be searchable & return results appropiately, these fields are: tradingName | phoneNumber | dealerAddress | dealerSuburb | australianState | dealerPostcode.
So, after all the mapping is done, I can click 'search button' with or without adding anything to the 'input' field and get a blind really big search result that takes forever to load up. Not good!!
I need the client (end-user) to type in any of the above fields, it could be the town/suburb name or the postcode & it'll return a result(s). Except, I am honestly to god stuck.
According appery.io I can use this: return '{"":{"$regex":"^' + value + '", "$options":"i"}}';
But when I enter any of the 1 fields above, it'll return and search 'tradingName' only and nothing else.
Annoying isn't it?
I have also done some internet searching and tried other suggestions which included the following:
return '{"tradingName" || "phoneNumber":"dealerAddress":"dealerSuburb":"australianState":"dealerPostcode":{"$regex":"^' + value + '", "$options":"i"}}';
also, zip-nada-no joy.
How does the mapping works: 'input field' linked by black line too 'where' which is also the database query & this is where I need to enter that JS (javascript) code.
Any suggestions?
Thank You,
- Benj