<commit_before>'use strict';

angular.module('arachne.widgets.directives')

.directive('con10tSearchQuery', ['$location', function($location) {
return {
    restrict: 'A',

    scope: {
        con10tSearchQuery: '@',
        con10tSearchFacet: '@',
        con10nSearchPage: '@',
        con10tSearchScope: '@'
    },

    link: function(scope, element, attrs) {

        attrs.$observe('con10tSearchQuery', function(value) {
            scope.q = value;
            updateHref();
        });

        attrs.$observe('con10tSearchFacet', function(value) {
            scope.fq = value;
            updateHref();
        });

        function updateHref() {
            var href = '';

            if (typeof scope.con10tSearchScope === "undefined") {
				href = $location.url();
            } else if (scope.con10tSearchScope !== '/') {
				href = 'project/'+ scope.con10tSearchScope;
            }

			href += '/';
            href += (typeof scope.con10tSearchPage !== "undefined") ? scope.con10tSearchPage : 'search';

			scope.q = ((typeof scope.q !== "undefined") && scope.q) ? scope.q : '*';
            href +=  '?q=' + scope.q;
<commit_msg>Fix a bug where the con10t-search-query directive would not work on urls with parameters.<commit_after>'use strict';

angular.module('arachne.widgets.directives')

.directive('con10tSearchQuery', ['$location', function($location) {
return {
    restrict: 'A',

    scope: {
        con10tSearchQuery: '@',
        con10tSearchFacet: '@',
        con10nSearchPage: '@',
        con10tSearchScope: '@'
    },

    link: function(scope, element, attrs) {

        attrs.$observe('con10tSearchQuery', function(value) {
            scope.q = value;
            updateHref();
        });

        attrs.$observe('con10tSearchFacet', function(value) {
            scope.fq = value;
            updateHref();
        });

        function updateHref() {
            var href = '';

            if (typeof scope.con10tSearchScope === "undefined") {
				href = $location.path();
            } else if (scope.con10tSearchScope !== '/') {
				href = 'project/'+ scope.con10tSearchScope;
            }

			href += '/';
            href += (typeof scope.con10tSearchPage !== "undefined") ? scope.con10tSearchPage : 'search';

			scope.q = ((typeof scope.q !== "undefined") && scope.q) ? scope.q : '*';
            href +=  '?q=' + scope.q;

{'fraction_non_alphanumeric': 0.16210526315789472, 'fraction_numerical': 0.021052631578947368, 'mean_word_length': 2.259259259259259, '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': '122224', 'n_tokens_mistral': 775, 'n_tokens_neox': 710, 'n_words': 133}