<commit_before>$(function() {
  // Initialize lunr with the fields to be searched, plus the boost.
  window.idx = lunr(function () {
    this.field('id');
    this.field('postHeading');
    this.field('subHeading');
    this.field('content', { boost: 10 });
    this.field('date');
    this.field('tags');
    this.field('image');
  });
  
  // Get the generated search_data.json file so lunr.js can search it locally.
  window.data = $.getJSON('/search-data.json');

  // Wait for the data to load and add it to lunr
  window.data.then(function(loaded_data){
    $.each(loaded_data, function(index, value){
      window.idx.add(
        $.extend({ "id": index }, value)
      );
    });
  });
  
  // Event when the form is submitted
  $("#site_search").submit(function(event){
      event.preventDefault();
      var query = $("#search_box").val(); // Get the value from the search field
      var results = window.idx.search(query); // Get lunr to perform a search
      display_search_results(results); // Hand the results off to be displayed
  });
  
  function display_search_results(results) {
    // Wait for data to load
    window.data.then(function(loaded_data) {
      // Are there any results?
      if (results.length) { 
		// Clear any old results
        $("#search_results").empty();
		// Hide blog entries
		$("#entries").hide();
		// Clear search box field
		$("#search_box").val = "";
        // Iterate over the results
        results.forEach(function(result,i) {
          var item = loaded_data[result.ref];		  
		  // Build a snippet of HTML for this result, add loop index
		  build_html(i, item.url, item.postHeading, item.subHeading, item.date, item.tags.split(', '));
        });
		// Create load more button
		build_load_more_button();
		// Redirect to search_results div
		window.location.href = "#search_results";
      } else {
        // If there are no results, let the user know.
		$("#no-results").css('display', 'block');
      }
    });
  }
  
  function build_html(index, url, heading, subHeading, date, tags)
  {
	  var heading_ = document.createElement("h3");
	  heading_.innerHTML = heading;
	  
	  var subHeading_ = document.createElement("h5");<commit_msg>changed code to Clear search box field<commit_after>$(function() {
  // Initialize lunr with the fields to be searched, plus the boost.
  window.idx = lunr(function () {
    this.field('id');
    this.field('postHeading');
    this.field('subHeading');
    this.field('content', { boost: 10 });
    this.field('date');
    this.field('tags');
    this.field('image');
  });
  
  // Get the generated search_data.json file so lunr.js can search it locally.
  window.data = $.getJSON('/search-data.json');

  // Wait for the data to load and add it to lunr
  window.data.then(function(loaded_data){
    $.each(loaded_data, function(index, value){
      window.idx.add(
        $.extend({ "id": index }, value)
      );
    });
  });
  
  // Event when the form is submitted
  $("#site_search").submit(function(event){
      event.preventDefault();
      var query = $("#search_box").val(); // Get the value from the search field
      var results = window.idx.search(query); // Get lunr to perform a search
      display_search_results(results); // Hand the results off to be displayed
  });
  
  function display_search_results(results) {
    // Wait for data to load
    window.data.then(function(loaded_data) {
      // Are there any results?
      if (results.length) { 
		// Clear any old results
        $("#search_results").empty();
		// Hide blog entries
		$("#entries").hide();
		// Clear search box field
		$("#search_box").empty();
        // Iterate over the results
        results.forEach(function(result,i) {
          var item = loaded_data[result.ref];		  
		  // Build a snippet of HTML for this result, add loop index
		  build_html(i, item.url, item.postHeading, item.subHeading, item.date, item.tags.split(', '));
        });
		// Create load more button
		build_load_more_button();
		// Redirect to search_results div
		window.location.href = "#search_results";
      } else {
        // If there are no results, let the user know.
		$("#no-results").css('display', 'block');
      }
    });
  }
  
  function build_html(index, url, heading, subHeading, date, tags)
  {
	  var heading_ = document.createElement("h3");
	  heading_.innerHTML = heading;
	  
	  var subHeading_ = document.createElement("h5");
{'fraction_non_alphanumeric': 0.14708540442837778, 'fraction_numerical': 0.0018075011296882061, 'mean_word_length': 2.8596338273757627, 'pattern_counts': {'":': 2, '<': 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': '5058688', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1319, 'n_words': 369}