<commit_before>'use strict';

(function() {
  var app = angular.module('portal.search.controllers', []);
  app.controller('SearchController', [ 'marketplaceService', '$location', '$scope', '$localStorage', function(marketplaceService, $location, $scope, $localStorage) {
      $scope.initialFilter = '';
      $scope.filterMatches = [];
      $scope.portletListLoading = true;
      if($localStorage && $localStorage.typeaheadSearch) {
          marketplaceService.getPortlets().then(function(data){
              $scope.portlets = data.portlets;
              $scope.portletListLoading = false;
          });
      }

      $scope.$watch('initialFilter', function(newVal, oldVal) {
          if (!newVal || !$scope.portlets) {
              $scope.filterMatches = [];
              return;
          }

          $scope.filterMatches = marketplaceService.filterPortletsBySearchTerm($scope.portlets, newVal);
      });

      $scope.onSelect = function(portlet) {
          $location.path("/apps/search/"+ portlet.name);
          $scope.initialFilter = "";
          $scope.showSearch = false;
          $scope.showSearchFocus = false;
      };<commit_msg>MUMUP-1770 : auto complete selection now goes to details<commit_after>'use strict';

(function() {
  var app = angular.module('portal.search.controllers', []);
  app.controller('SearchController', [ 'marketplaceService', '$location', '$scope', '$localStorage', function(marketplaceService, $location, $scope, $localStorage) {
      $scope.initialFilter = '';
      $scope.filterMatches = [];
      $scope.portletListLoading = true;
      if($localStorage && $localStorage.typeaheadSearch) {
          marketplaceService.getPortlets().then(function(data){
              $scope.portlets = data.portlets;
              $scope.portletListLoading = false;
          });
      }

      $scope.$watch('initialFilter', function(newVal, oldVal) {
          if (!newVal || !$scope.portlets) {
              $scope.filterMatches = [];
              return;
          }

          $scope.filterMatches = marketplaceService.filterPortletsBySearchTerm($scope.portlets, newVal);
      });

      $scope.onSelect = function(portlet) {
          $location.path("/apps/details/"+ portlet.fname);
          $scope.initialFilter = "";
          $scope.showSearch = false;
          $scope.showSearchFocus = false;
      };
{'fraction_non_alphanumeric': 0.14667231877914372, 'fraction_numerical': 0.001695633743111488, 'mean_word_length': 2.722397476340694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4264255', 'n_tokens_mistral': 659, 'n_tokens_neox': 648, 'n_words': 99}