Building a search bar using queryContacts

I’m trying to make a portal on the site to allow admin users to search for club members. I have created a custom field in Contacts called Member Number. I want the search bar to query the contacts and find all members by name or partial name and return the Member Number. Here is my backend code:

export function searchContactName ( searchTerm ) {
const options = {
suppressAuth : true

return contacts . queryContacts ()
. hasSome ( “” ,[ searchTerm ])
. limit ( 15 )
. find ( options )
. then (( queryResults ) => {
const items = queryResults . items ;
return items ;
. catch (( error ) => {
console . error ( error );


Two issues:

  1. is there a way to filter results with partial names or case insensitive search? Currently user has to spell the last name exactly to return results.

  2. My commented out line is trying to filter out the Contacts that do not have Member Numbers. It doesn’t work as written. Any advice here? My data set includes over 2,000 contacts but only 400 or so have Member Numbers. I guess I could create another helper field or add a Label to all Club Members and filter on that. Was hoping to just use the single field.

Thanks in advance for any advice.

P.S. Normally would just have the client use the Wix admin area to manage the Contacts but Client lead doesn’t want this.