This code takes a Sharepoint list containing over 4000 items and allows the app user to search the list by legal name (Title) or PreferredName.
It sorts ascending and will show most of the sharepoint list items when the gallery is first loaded or if the app users resets the search text box.
However, it will search/filter the entire sharepoint list.