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

  angular
    .module('lucidworksView.components.searchbox')
    .directive('searchBox', searchbox);

  function searchbox() {
    'ngInject';
    return {
      restrict: 'EA',
      controller: Controller,
      templateUrl: 'assets/components/searchBox/searchBox.html',
      scope: true,
      controllerAs: 'ta',
      bindToController: {
        query: '='
      },
      require: '^form'
    };
  }

  function Controller($scope, $q, ConfigService, QueryService,
    SearchBoxDataService) {
    'ngInject';
    var ta = this;
    ta.typeaheadField = ConfigService.getTypeaheadField();
    ta.doTypeaheadSearch = doTypeaheadSearch;
    ta.selectedSomething = selectedSomething;
    ta.updateSearchQuery = updateSearchQuery;
    ta.initialValue = _.isArray(ta.query)?ta.query[0]:ta.query;

    function selectedSomething(object) {
      if (object) {
        var newValue = object.originalObject[ta.typeaheadField];
        ta.query = _.isArray(newValue)?newValue[0]:newValue;
      }
    }

    function updateSearchQuery(inputString) {
      ta.query = inputString;
    }

    function doTypeaheadSearch(userInputString, timeoutPromise) {
      var deferred = $q.defer();

      SearchBoxDataService
        .getTypeaheadResults(QueryService.getQueryObject())
        .then(function (resp) {
          if(resp.hasOwnProperty('response')) {
            var objectToResolve = {
              data: resp.response.docs
            };
            deferred.resolve(objectToResolve);
          } else {
            deferred.reject('No response docs');
          }
        })
        .catch(function (error) {
          timeoutPromise.reject(error);
        });

      return deferred.promise;
    }


  }

})();<commit_msg>Fixed typeahead bug (same query everytime)  - Changed the service call argument accordingly  - From QueryService.getQueryObject()  - To {q: query, wt: json}<commit_after>(function () {
  'use strict';

  angular
    .module('lucidworksView.components.searchbox')
    .directive('searchBox', searchbox);

  function searchbox() {
    'ngInject';
    return {
      restrict: 'EA',
      controller: Controller,
      templateUrl: 'assets/components/searchBox/searchBox.html',
      scope: true,
      controllerAs: 'ta',
      bindToController: {
        query: '='
      },
      require: '^form'
    };
  }

  function Controller($scope, $q, ConfigService, QueryService,
    SearchBoxDataService) {
    'ngInject';
    var ta = this;
    ta.typeaheadField = ConfigService.getTypeaheadField();
    ta.doTypeaheadSearch = doTypeaheadSearch;
    ta.selectedSomething = selectedSomething;
    ta.updateSearchQuery = updateSearchQuery;
    ta.initialValue = _.isArray(ta.query)?ta.query[0]:ta.query;

    function selectedSomething(object) {
      if (object) {
        var newValue = object.originalObject[ta.typeaheadField];
        ta.query = _.isArray(newValue)?newValue[0]:newValue;
      }
    }

    function updateSearchQuery(inputString) {
      ta.query = inputString;
    }

    function doTypeaheadSearch(userInputString, timeoutPromise) {
      var deferred = $q.defer();

      SearchBoxDataService
        .getTypeaheadResults({q: ta.query, wt: 'json'})
        .then(function (resp) {
          if(resp.hasOwnProperty('response')) {
            var objectToResolve = {
              data: resp.response.docs
            };
            deferred.resolve(objectToResolve);
          } else {
            deferred.reject('No response docs');
          }
        })
        .catch(function (error) {
          timeoutPromise.reject(error);
        });

      return deferred.promise;
    }


  }

})();
{'fraction_non_alphanumeric': 0.11959771677086165, 'fraction_numerical': 0.0010872519706441968, 'mean_word_length': 2.5181644359464626, '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': '4329416', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1052, 'n_words': 187}