Improved facet typeahead code