<commit_before>;(function($) {
	$(function() {

		// Bind autocomplete to the search form.

		var search = $('input.extensible-search');
		if(search.length) {
			search.autocomplete({

				// Determine whether to disable search suggestions, based on configuration.

				disabled: !search.data('suggestions-enabled'),

				// Enforce a minimum autocomplete length.

				minLength: 3,

				// Retrieve the most relevant search suggestions that have been approved.

				source: function(request, response) {

					$.get('extensible-search-api/getSuggestions', {
						term: request.term,
						page: search.data('extensible-search-page')
					})
					.done(function(data) {

						response(data);
					});
				}
			});
		}

	});
})(jQuery);
<commit_msg>Fix(input) support search suggestion for multiple extensible search inputs on a single page<commit_after>;
(function ($) {
    $(function () {

        // Bind autocomplete to the primary search form.

        var searchInputs = $('input.extensible-search');
        if (searchInputs.length) {
            searchInputs.each(function () {
                var search = $(this);
                // Retrieve the search suggestions that have been approved.

                var suggestions = [];
                $.get('extensible-search-api/getPageSuggestions', {
                    page: search.data('extensible-search-page')
                })
                        .done(function (data) {

                            suggestions = data;
                        });

                // Initialise the autocomplete.

                search.autocomplete({

                    // Determine whether to disable search suggestions, based on configuration.

                    disabled: !search.data('suggestions-enabled'),

                    // Enforce a minimum autocomplete length.

                    minLength: 3,

                    // Determine the most relevant search suggestions that have been approved.

                    source: function (request, response) {

                        // Perform client side filtering, which provides a massive performance increase!

                        var term = search.val();
                        var options = [];
                        $.each(suggestions, function () {

                            if (term === this.substr(0, term.length)) {
                                options.push({
                                    'label': term + '<strong>' + this.substr(term.length) + '</strong>',
                                    'value': this
                                });

                                // Enforce a limit.

                                if (options.length === 5) {
                                    return false;
                                }
                            }
                        });
                        response(options);
                    }
                })

                        // This needs to render HTML.

                        .data('ui-autocomplete')._renderItem = function (ul, item) {

                    return $('<li>').append($('<div>').html(item.label)).appendTo(ul);
                };
            });
        }
    });
})(jQuery);

{'fraction_non_alphanumeric': 0.10945736434108527, 'fraction_numerical': 0.00124031007751938, 'mean_word_length': 1.254367575122292, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3827508', 'n_tokens_mistral': 846, 'n_tokens_neox': 694, 'n_words': 186}