<commit_before>app.controller('SearchController', function($scope, $state, $q, KpmApi) {

  var self = this;

  /**
   * Callback when 'Return' key is pressed
   * Redirect to the package list page
   */
  this.submit = function() {
    $state.go('packages', {search: this.searchText});
  };

  /**
   * Callback when a suggested item is selected
   * Redirect to the package view page
   */
  this.itemSelected = function(item) {
    $state.go('package', {name: item.name});
  };

  /**
   * Autocomplete suggestion callback
   * @return promise
   */
  this.querySearch = function(search) {
    var deferred = $q.defer();
    KpmApi.get('packages', {
      named_like: search
    })
    .success(function(data) {
      deferred.resolve(data);
    });
    return deferred.promise;
  };
});<commit_msg>Clear search text after action<commit_after>app.controller('SearchController', function($scope, $state, $q, KpmApi) {

  var self = this;

  /**
   * Callback when 'Return' key is pressed
   * Redirect to the package list page
   */
  this.submit = function() {
    $state.go('packages', {search: this.searchText});
    this.searchText = null;
  };

  /**
   * Callback when a suggested item is selected
   * Redirect to the package view page
   */
  this.itemSelected = function(item) {
    $state.go('package', {name: item.name});
    this.searchText = null;
  };

  /**
   * Autocomplete suggestion callback
   * @return promise
   */
  this.querySearch = function(search) {
    var deferred = $q.defer();
    KpmApi.get('packages', {
      named_like: search
    })
    .success(function(data) {
      deferred.resolve(data);
    });
    return deferred.promise;
  };
});
{'fraction_non_alphanumeric': 0.14669051878354203, 'fraction_numerical': 0.0, 'mean_word_length': 2.948235294117647, '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': '3390034', 'n_tokens_mistral': 535, 'n_tokens_neox': 520, 'n_words': 128}