<commit_before>ZBase.registerView((function() {

  var load = function(path) {
    var tpl = $.getTemplate(
        "views/search_results",
        "zbase_search_results_main_tpl");

    var main_menu = ZBaseMainMenu();
    main_menu.render($(".zbase_main_menu", tpl), path);

    var search_term = UrlUtil.getParamValue(path, "q");

    $.httpGet("/api/v1/documents?search=" + search_term, function(r) {
      if (r.status == 200) {
        var resp = JSON.parse(r.response);

        if (resp.documents.length > 1) {
          renderTable(resp.documents);
        }
      }
    });

    $.replaceViewport(tpl);
  };

  var renderTable = function(docs) {
    var tbody = $(".zbase_search_results tbody");<commit_msg>search_results: renderTable/redirect to doc view<commit_after>ZBase.registerView((function() {

  var load = function(path) {
    var tpl = $.getTemplate(
        "views/search_results",
        "zbase_search_results_main_tpl");

    var main_menu = ZBaseMainMenu();
    main_menu.render($(".zbase_main_menu", tpl), path);

    var search_term = UrlUtil.getParamValue(path, "q");

    $.httpGet("/api/v1/documents?search=" + search_term, function(r) {
      if (r.status == 200) {
        var resp = JSON.parse(r.response);

        if (resp.documents.length == 0) {
          console.log(resp);
          return;
        }

        if (resp.documents.length == 1 && resp.documents[0].name == search_term) {
          var doc = resp.documents[0];
          //TODO pop search path from history
          $.navigateTo(getUrlForDocType(doc.type) + doc.uuid);
          return;
        }

        renderTable(resp.documents);
      }
    });

    $.replaceViewport(tpl);
  };

  var renderTable = function(docs) {
    var tbody = $(".zbase_search_results tbody");
{'fraction_non_alphanumeric': 0.14752252252252251, 'fraction_numerical': 0.00731981981981982, 'mean_word_length': 2.648870636550308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4437349', 'n_tokens_mistral': 598, 'n_tokens_neox': 567, 'n_words': 102}