code: function handleSearchText (searchText, previousSearchText) {
      ctrl.index = getDefaultIndex();
  
      // do nothing on init
      if (searchText === previousSearchText) return;
  
      updateModelValidators();
  
      getDisplayValue($scope.selectedItem).then(function (val) {
        // clear selected item if search text no longer matches it
        if (searchText !== val) {
          $scope.selectedItem = null;
  
  
          // trigger change event if available
          if (searchText !== previousSearchText) announceTextChange();
  
          // cancel results if search text is not long enough
          if (!isMinLengthMet()) {
            ctrl.matches = [];
  
            setLoading(false);
            reportMessages(false, ReportType.Count);
  
          } else {
            handleQuery();
          }
        }
      });
  
    }
docs: Handles changes to the searchText property.
  @param searchText
  @param previousSearchText