<commit_before>// Init site search suggestions and populate the suggestions container.
(function() {
    // MKT search init.
    $('#search #search-q').searchSuggestions($('#site-search-suggestions'),
                                             processResults, 'MKT');

    var previous_request;

    function processResults(settings) {
        if (!settings) {
            return;
        }

        var li_item = template(
            '<li><a href="{url}"><span>{name}</span></a></li>'
        );

        // Note that if ajaxCache doesn't need to make a new request, it will
        // return `undefined`.
        var new_request = $.ajaxCache({
            url: settings['$results'].attr('data-src'),
            data: settings['$form'].serialize() + '&cat=' + settings.category,
            newItems: function(formdata, items) {
                var eventName;
                if (items !== undefined) {
                    var ul = '';
                    $.each(items, function(i, item) {
                        var d = {
                            url: escape_(item.url) || '#'
                        };
                        if (item.name) {
                            d.name = escape_(item.name);
                            // Append the item only if it has a name.
                            ul += li_item(d);
                        }
                    });
                    settings['$results'].find('ul').html(ul);
                }
                settings['$results'].addClass('visible')
                                    .trigger('resultsUpdated', [items]);
                $('#site-header').addClass('suggestions');
            }
        });
        
        if (previous_request) {
            previous_request.abort();
        }
        previous_request = new_request;
    }<commit_msg>disable gaia search suggestions for now<commit_after>// Init site search suggestions and populate the suggestions container.
(function() {
    // MKT search init.
    if (!z.capabilities.gaia) { // Disable suggestions on Gaia for now.
        $('#search #search-q').searchSuggestions($('#site-search-suggestions'),
                                                 processResults, 'MKT');
    }

    var previous_request;

    function processResults(settings) {
        if (!settings) {
            return;
        }

        var li_item = template(
            '<li><a href="{url}"><span>{name}</span></a></li>'
        );

        // Note that if ajaxCache doesn't need to make a new request, it will
        // return `undefined`.
        var new_request = $.ajaxCache({
            url: settings['$results'].attr('data-src'),
            data: settings['$form'].serialize() + '&cat=' + settings.category,
            newItems: function(formdata, items) {
                var eventName;
                if (items !== undefined) {
                    var ul = '';
                    $.each(items, function(i, item) {
                        var d = {
                            url: escape_(item.url) || '#'
                        };
                        if (item.name) {
                            d.name = escape_(item.name);
                            // Append the item only if it has a name.
                            ul += li_item(d);
                        }
                    });
                    settings['$results'].find('ul').html(ul);
                }
                settings['$results'].addClass('visible')
                                    .trigger('resultsUpdated', [items]);
                $('#site-header').addClass('suggestions');
            }
        });

        if (previous_request) {
            previous_request.abort();
        }
        previous_request = new_request;
    }
{'fraction_non_alphanumeric': 0.13087606837606838, 'fraction_numerical': 0.0, 'mean_word_length': 1.2344868735083532, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3494336', 'n_tokens_mistral': 916, 'n_tokens_neox': 869, 'n_words': 205}