<commit_before>(function (window) {
  'use strict';

  var angular = window.angular;
  var _ = window._;
  var moment = window.moment;

  angular.module('bowerBrowser')
    .controller('SearchController', function ($scope, $timeout, BowerService, ProcessService, SearchService) {

      var timer;

      // Properties
      $scope.service = SearchService;
      $scope.query = $scope.service.query;

      // Install component
      $scope.install = function (name, version) {
        var target = name;
        if (typeof version !== 'undefined' && version !== '') {
          target = target + '#' + version;
        }
        ProcessService.execute('bower install --save ' + target);
      };

      // Uninstall component
      $scope.uninstall = function (name) {
        ProcessService.execute('bower uninstall --save ' + name);
      };

      // Check installation
      $scope.isInstalled = function (name) {
        return _.has(BowerService.json.dependencies, name);
      };

      // Get installed version
      $scope.getVersion = function (name) {
        return BowerService.json.dependencies[name];
      };

      // Formant date
      $scope.timeago = function (date) {
        return moment(date).fromNow();
      };

      // Got to previous page
      $scope.goPrev = function () {
        $scope.service.goPrev();
      };

      // Go to next page
      $scope.goNext = function () {
        $scope.service.goNext();
      };

      // Sort component list by field
      $scope.sortBy = function (field) {
        if (!$scope.service.loaded) {
          return;
        }
        $scope.service.sortBy(field);
      };

      // Return class name according to the sort setting
      $scope.getSortedClass = function (field) {
        var className = '';
        if ($scope.service.sortField === field) {
          className = $scope.service.sortReverse ? 'sort-descend' : 'sort-ascend';
        }
        return className;
      };

      // Sync query value with service
      $scope.$watch('service.query', function (query) {
        $scope.query = query;
      });

      $scope.$watch('query', function (query) {
        if (timer) {
          $timeout.cancel(timer);
        }
        timer = $timeout(function () {
          $scope.service.query = query;
          $scope.service.search();
        }, 300);
      });

      // Initialize
      if (!$scope.service.loaded) {
        $scope.service.loadComponents();
      }
      else {
        $scope.service.resetResults();
      }

    });

}(window));<commit_msg>Don't reset search params<commit_after>(function (window) {
  'use strict';

  var angular = window.angular;
  var _ = window._;
  var moment = window.moment;

  angular.module('bowerBrowser')
    .controller('SearchController', function ($scope, $timeout, BowerService, ProcessService, SearchService) {

      var timer;

      // Properties
      $scope.service = SearchService;
      $scope.query = $scope.service.query;

      // Install component
      $scope.install = function (name, version) {
        var target = name;
        if (typeof version !== 'undefined' && version !== '') {
          target = target + '#' + version;
        }
        ProcessService.execute('bower install --save ' + target);
      };

      // Uninstall component
      $scope.uninstall = function (name) {
        ProcessService.execute('bower uninstall --save ' + name);
      };

      // Check installation
      $scope.isInstalled = function (name) {
        return _.has(BowerService.json.dependencies, name);
      };

      // Get installed version
      $scope.getVersion = function (name) {
        return BowerService.json.dependencies[name];
      };

      // Formant date
      $scope.timeago = function (date) {
        return moment(date).fromNow();
      };

      // Got to previous page
      $scope.goPrev = function () {
        $scope.service.goPrev();
      };

      // Go to next page
      $scope.goNext = function () {
        $scope.service.goNext();
      };

      // Sort component list by field
      $scope.sortBy = function (field) {
        if (!$scope.service.loaded) {
          return;
        }
        $scope.service.sortBy(field);
      };

      // Return class name according to the sort setting
      $scope.getSortedClass = function (field) {
        var className = '';
        if ($scope.service.sortField === field) {
          className = $scope.service.sortReverse ? 'sort-descend' : 'sort-ascend';
        }
        return className;
      };

      // Sync query value with service
      $scope.$watch('service.query', function (query) {
        $scope.query = query;
      });

      $scope.$watch('query', function (query) {
        if (timer) {
          $timeout.cancel(timer);
        }
        timer = $timeout(function () {
          if ($scope.service.query === query) {
            return;
          }
          $scope.service.query = query;
          $scope.service.search();
        }, 300);
      });

      // Initialize
      if (!$scope.service.loaded) {
        $scope.service.loadComponents();
      }

    });

}(window));
{'fraction_non_alphanumeric': 0.1388997268825595, 'fraction_numerical': 0.0011705033164260631, 'mean_word_length': 1.934745277618775, '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': '2132910', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1395, 'n_words': 318}