move typeahead query length logic into javascript.
ensure typeahead is not called when search bar is missing. add trim to typeahead logic.