<commit_before>'use strict';

angular.module('arachne.controllers')

/**
 * @author: <NAME>
 * @author: <NAME>
 * @author <NAME>
 */


    .controller('SearchController', ['$rootScope', '$scope', 'searchService', 'categoryService', '$filter',
        'arachneSettings', '$location', 'Catalog', 'messageService', '$uibModal', '$http', 'Entity',
        'authService', '$timeout', 'searchScope',
        function ($rootScope, $scope, searchService, categoryService, $filter,
                  arachneSettings, $location, Catalog, messages, $uibModal, $http, Entity,
                  authService, $timeout, searchScope) {

            searchService.initQuery();

            // To indicate that the query will not be performed because it violates one or more constraints of some sort
            $scope.illegalQuery = false;
            $rootScope.tinyFooter = false;
            $scope.user = authService.getUser();
            $scope.currentQuery = searchService.currentQuery();

            $scope.getSearchTitle = searchScope.currentScopeTitle;

            $scope.q = angular.copy($scope.currentQuery.q);
            $scope.sortableFields = arachneSettings.sortableFields;

            var HIDDEN_FACETS = ['agg_geogrid', 'facet_geo'];

            // Ignore unknown sort fields
            if (arachneSettings.sortableFields.indexOf($scope.currentQuery.sort) === -1) {
                delete $scope.currentQuery.sort;
            }

            categoryService.getCategoriesAsync().then(function (categories) {
                $scope.categories = categories;
            });

            $scope.openDownloadDialog = function() {
                var modalInstance = $uibModal.open({
                    templateUrl: 'app/export/download-modal.html',
                    controller: 'DownloadController',
                    resolve: {
                        downloadUrl: function() {
                            var finalQuery = $scope.currentQuery.extend(searchScope.currentScopeData());
                            // failsafe control if query is empty
                            if (angular.isUndefined(finalQuery.q === undefined)) {
                                finalQuery.q = '*';
                            }
                            finalQuery.removeParam('limit');
                            finalQuery.setParam('fl',1);
                            return '/search' + finalQuery.toString();
                        }
                    }
                });
                modalInstance.result.then(function() {
                    $window.location.reload();
                });
            };

            $scope.createCatalogTextForCurrentQuery = function () {

                var curQuery = $scope.currentQuery,
                    text = curQuery.toFlatObject().q,
                    facets = curQuery.toFlatObject().fq,
                    len = facets.length;

                for (var i = 0; i < len; i++) {
                    text += " " + curQuery.toFlatObject().fq[i];
                }

                return text;
            };

            $scope.createCatalogEntryText = function (entity) {

                var catalogEntryText = "";<commit_msg>fix limit restrictions of data export<commit_after>'use strict';

angular.module('arachne.controllers')

/**
 * @author: <NAME>
 * @author: <NAME>
 * @author <NAME>
 */


    .controller('SearchController', ['$rootScope', '$scope', 'searchService', 'categoryService', '$filter',
        'arachneSettings', '$location', 'Catalog', 'messageService', '$uibModal', '$http', 'Entity',
        'authService', '$timeout', 'searchScope',
        function ($rootScope, $scope, searchService, categoryService, $filter,
                  arachneSettings, $location, Catalog, messages, $uibModal, $http, Entity,
                  authService, $timeout, searchScope) {

            searchService.initQuery();

            // To indicate that the query will not be performed because it violates one or more constraints of some sort
            $scope.illegalQuery = false;
            $rootScope.tinyFooter = false;
            $scope.user = authService.getUser();
            $scope.currentQuery = searchService.currentQuery();

            $scope.getSearchTitle = searchScope.currentScopeTitle;

            $scope.q = angular.copy($scope.currentQuery.q);
            $scope.sortableFields = arachneSettings.sortableFields;

            var HIDDEN_FACETS = ['agg_geogrid', 'facet_geo'];

            // Ignore unknown sort fields
            if (arachneSettings.sortableFields.indexOf($scope.currentQuery.sort) === -1) {
                delete $scope.currentQuery.sort;
            }

            categoryService.getCategoriesAsync().then(function (categories) {
                $scope.categories = categories;
            });

            $scope.openDownloadDialog = function() {
                var modalInstance = $uibModal.open({
                    templateUrl: 'app/export/download-modal.html',
                    controller: 'DownloadController',
                    resolve: {
                        downloadUrl: function() {
                            var finalQuery = $scope.currentQuery.extend(searchScope.currentScopeData());
                            // failsafe control if query is empty
                            if (angular.isUndefined(finalQuery.q === undefined)) {
                                finalQuery.q = '*';
                            }
                            finalQuery = finalQuery.setParam('limit', searchService.getSize());
                            finalQuery = finalQuery.setParam('fl', 1);
                            return '/search' + finalQuery.toString();
                        }
                    }
                });
                modalInstance.result.then(function() {
                    $window.location.reload();
                });
            };

            $scope.createCatalogTextForCurrentQuery = function () {

                var curQuery = $scope.currentQuery,
                    text = curQuery.toFlatObject().q,
                    facets = curQuery.toFlatObject().fq,
                    len = facets.length;

                for (var i = 0; i < len; i++) {
                    text += " " + curQuery.toFlatObject().fq[i];
                }

                return text;
            };

            $scope.createCatalogEntryText = function (entity) {

                var catalogEntryText = "";
{'fraction_non_alphanumeric': 0.11474647232129012, 'fraction_numerical': 0.000930376802605055, 'mean_word_length': 1.5976641159887233, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2622862', 'n_tokens_mistral': 1607, 'n_tokens_neox': 1513, 'n_words': 311}