<commit_before>//Select2 functionality initialization
function initSelect2(data) {
    var $select = $('#value.select2').select2({
        placeholder: "Value, for db values type database:",
        data: data,
        multiple: true,
        dropdownAutoWidth: true,
        containerCssClass: 'custom-env-class-for-demo select',
        width: '350px',
        tags: true,
        selectOnBlur: true,
        createSearchChoice: function(term, data) {
            if ($(data).filter(function() {
                    return this.text.localeCompare(term) === 0;
                }).length === 0) {
                return {
                    id: term,
                    text: term
                };
            }
        },
    });

    $select.on("select2:select", function(e) {
        var l = $select.select2('data');
        e.params.data.text = e.params.data.id;
        $select.val(e.params.data.id).trigger('change');
        if (e.params.data.isNew != undefined && e.params.data.isNew) {
            $select.empty();
            $select.select2("val", "Invalid Selection");
        } else if (e.params.data.isNextLevel) {
            $select.empty();
            $select.trigger('change');
            $select = initSelect2(e.params.data.data);
            $select.select2('open');
        }
    });

    $select.on("select2:close", function(e) {
        var highlighted = $(e.target).data('select2').$dropdown.find('.select2-results__option--highlighted');
        if (highlighted) {
            var data = highlighted.data('data');
            var id = data.id;
            var display = data.name;
            if (id != 0) {
                $select.select2("val", id);
            }
        }
    });

    $(".select2-search__field").keypress(function(e) {
        if ($(this).val() == "database:") {
            var dbs;
            jagg.post("../blocks/database/list/ajax/list.jag", {
                action: "getAllDatabasesInfo"
            }, function(result) {
                dbs = JSON.parse(result);
                $select.trigger('change');
                $select = initSelect2(dbs);
                $select.select2('open');
            });
        }
    });

    //noinspection JSAnnotator
    return $select;
}<commit_msg>Fix for need to add space after 'database:'. Fixed by changing the event for keyup<commit_after>//Select2 functionality initialization
function initSelect2(data) {
    var $select = $('#value.select2').select2({
        placeholder: "Value, for db values type database:",
        data: data,
        multiple: true,
        dropdownAutoWidth: true,
        containerCssClass: 'custom-env-class-for-demo select',
        width: '350px',
        tags: true,
        selectOnBlur: true,
        createSearchChoice: function(term, data) {
            if ($(data).filter(function() {
                    return this.text.localeCompare(term) === 0;
                }).length === 0) {
                return {
                    id: term,
                    text: term
                };
            }
        },
    });

    $select.on("select2:select", function(e) {
        var l = $select.select2('data');
        e.params.data.text = e.params.data.id;
        $select.val(e.params.data.id).trigger('change');
        if (e.params.data.isNew != undefined && e.params.data.isNew) {
            $select.empty();
            $select.select2("val", "Invalid Selection");
        } else if (e.params.data.isNextLevel) {
            $select.empty();
            $select.trigger('change');
            $select = initSelect2(e.params.data.data);
            $select.select2('open');
        }
    });

    $select.on("select2:close", function(e) {
        var highlighted = $(e.target).data('select2').$dropdown.find('.select2-results__option--highlighted');
        if (highlighted) {
            var data = highlighted.data('data');
            var id = data.id;
            var display = data.name;
            if (id != 0) {
                $select.select2("val", id);
            }
        }
    });

    $(".select2-search__field").keyup(function(e) {
        if ($(this).val() == "database:") {
            var dbs;
            jagg.post("../blocks/database/list/ajax/list.jag", {
                action: "getAllDatabasesInfo"
            }, function(result) {
                dbs = JSON.parse(result);
                $select.trigger('change');
                $select = initSelect2(dbs);
                $select.select2('open');
            });
        }
    });

    //noinspection JSAnnotator
    return $select;
}
{'fraction_non_alphanumeric': 0.15243101182654403, 'fraction_numerical': 0.009636443276390714, 'mean_word_length': 1.667640186915888, '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': '7248962', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1271, 'n_words': 234}