<commit_before>'use strict';

angular.module('chronontology.controllers')

.controller("SearchController", function($scope, $location) {

    $scope.getRegion = function(period) {

        if (!period.derived) {
            return '-';
        } else if(period.derived.namedAfter) {
            return period.derived.namedAfter[0].prefName.title;
        } else if(period.derived.hasCoreRegion) {
            return period.derived.hasCoreRegion[0].prefName.title;
        } else if(period.derived.spatiallyPartOfRegion) {
            return period.derived.spatiallyPartOfRegion[0].prefName.title;
        } else {
            return '-';
        }
    }

})<commit_msg>use configured gazetteer relations for showing region in search result<commit_after>'use strict';

angular.module('chronontology.controllers')

.controller("SearchController", function($scope, $location, chronontologySettings) {

    $scope.getRegion = function(doc) {

        if (!doc.derived) {
            return '-';
        } else {
            for (var i in chronontologySettings.gazetteerRelations) {
                var relation = chronontologySettings.gazetteerRelations[i];
                if (doc.derived[relation]) {
                    return doc.derived[relation][0].prefName.title;
                }
            }
        }
        return '-';
    }

})
{'fraction_non_alphanumeric': 0.1203288490284006, 'fraction_numerical': 0.0029895366218236174, 'mean_word_length': 2.3475, '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': '4132440', 'n_tokens_mistral': 382, 'n_tokens_neox': 361, 'n_words': 60}