<commit_before>var addressLookup = function(event) {
    var input = $("#address-lookup :input[name='search']"),
        searchValue = input.val().trim();
    event.preventDefault();
    $('#address-selector').hide();
    $('#addresses').empty();
    $('.message').empty();

    $.ajax({
          type: 'GET',
          url: 'http://address.openregister.org/search?_query='+searchValue+'&_representation=json',
          contentType: 'application/json',
          success: function(data) {
            if(data.length > 1000){
                $('.message').text('Too many results. Search for for something more specific.');
            } else {
                renderAddresses(data);
                $('#address-selector').show();
            }
          },
          error: function(xhr, options, error) {
            console.log(error);
            $('#addresses').empty();
            $('.message').text('No results');
        }
    });
};

var renderAddresses = function(addresses) {
    //TODO get server to sort results
    addresses.sort(function(a,b) {
        return a.entry.street.localeCompare(b.entry.street);
    });
    $.each(addresses, function(index, address) {
        var template = $.templates("#address-template"),
            html = template.render({
                'address': address.entry.address,<commit_msg>Addresses register returns entries<commit_after>var addressLookup = function(event) {
    var input = $("#address-lookup :input[name='search']"),
        searchValue = input.val().trim();
    event.preventDefault();
    $('#address-selector').hide();
    $('#addresses').empty();
    $('.message').empty();

    $.ajax({
          type: 'GET',
          url: 'http://address.openregister.org/search?_query='+searchValue+'&_representation=json',
          contentType: 'application/json',
          success: function(data) {
            if(data.length > 1000){
                $('.message').text('Too many results. Search for for something more specific.');
            } else {
                renderAddresses(data);
                $('#address-selector').show();
            }
          },
          error: function(xhr, options, error) {
            console.log(error);
            $('#addresses').empty();
            $('.message').text('No results');
        }
    });
};

var renderAddresses = function(addresses) {
    addresses.entries.sort(function(a,b) {
        return a.entry.street.localeCompare(b.entry.street);
    });
    $.each(addresses.entries, function(index, address) {
        var template = $.templates("#address-template"),
            html = template.render({
                'address': address.entry.address,
{'fraction_non_alphanumeric': 0.17022872140982379, 'fraction_numerical': 0.0029996250468691415, 'mean_word_length': 2.2536585365853656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '404416', 'n_tokens_mistral': 711, 'n_tokens_neox': 702, 'n_words': 128}