<commit_before>'use strict';

/**
 * @ngdoc directive
 *
 * @name solrSearch
 *
 * @description
 * Search input for solr
 */
(function() {

  angular
    .module('dhsniem')
    .directive('solrSearch', solrSearch);

  function solrSearch($location, $state, solrSearch) {
    return {
      restrict: 'E',
      templateUrl: 'app/components/solrSearch/solrSearch.directive.html',
      scope: {
        hasLabel: '='
      },
      link: link
    };

    /**
     *  Defines variables and functions within solrSearch scope
     */
    function link(scope, element, attrs, ctrl) {

      scope.states = ['DriverLicenseCardIdentification', 'CreditBankIDCardCategoryCode', 'CardPicture', 'CreditCard'];

      scope.searchQuery = $location.search().q;

      scope.search = function search() {

        var query = scope.searchQuery || '*';

        if ($location.path() !== '/results') {
          $state.go('main.results', {q: query});
        }
        
        $location.search('q', query);

        solrSearch.search();

      };

    }
<commit_msg>filters will automatically clear on new searches initiated from the solrSearch directive<commit_after>'use strict';

/**
 * @ngdoc directive
 *
 * @name solrSearch
 *
 * @description
 * Search input for solr
 */
(function() {

  angular
    .module('dhsniem')
    .directive('solrSearch', solrSearch);

  function solrSearch($location, $state, solrSearch) {
    return {
      restrict: 'E',
      templateUrl: 'app/components/solrSearch/solrSearch.directive.html',
      scope: {
        hasLabel: '='
      },
      link: link
    };

    /**
     *  Defines variables and functions within solrSearch scope
     */
    function link(scope, element, attrs, ctrl) {

      scope.states = ['DriverLicenseCardIdentification', 'CreditBankIDCardCategoryCode', 'CardPicture', 'CreditCard'];

      scope.searchQuery = $location.search().q;

      scope.search = function search() {

        var query = scope.searchQuery || '*';

        if ($location.path() !== '/results') {
          $state.go('main.results', {q: query});
        }
        
        $location.search('q', query);
        solrSearch.clearAllFilters();

      };

    }

{'fraction_non_alphanumeric': 0.14475492441594137, 'fraction_numerical': 0.0, 'mean_word_length': 2.574468085106383, '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': '5391348', 'n_tokens_mistral': 667, 'n_tokens_neox': 638, 'n_words': 137}