Fixed issue when trimming typeahead
New route to query db