")
- //console.log(results);
- for (i=0; i < autoCompleteResultLimit && i < results.length; i++)
- {
- //console.log(i, "of", autoCompleteResultLimit, "is underway");
- displayingAutcompleteResults.push(results[i].topic); //log results to global array
- resultsOutput.push("
");
- resultsOutput.push("
");
- resultsOutput.push("- ")
- resultsOutput.push("" + highlightMe(pages[results[i].topic].title,searchVal) + "");
- resultsOutput.push("
");
- resultsOutput.push("- ")
- resultsOutput.push(highlightMe(pages[results[i].topic].url,searchVal));
- resultsOutput.push("
");
- /*
- resultsOutput.push("- ")
- resultsOutput.push("Breadcrumb: " + breadcrumbString(pages[results[i]].url));
- resultsOutput.push("
");
- */
- if (pages[results[i].topic].keywords)
- {
- resultsOutput.push("- ")
- resultsOutput.push("Keywords: " + highlightMe(pages[results[i].topic].keywords,searchVal) + "");
- resultsOutput.push("
");
- }
- if (pages[results[i].topic].description)
- {
- resultsOutput.push("- ")
- resultsOutput.push("Description: " + highlightMe(pages[results[i].topic].description,searchVal));
- resultsOutput.push("
");
- }
- resultsOutput.push("
");
- resultsOutput.push("
")
- resultsShown++;
- }
- var resultsShownText = (resultsShown > 1) ? resultsShown + " of " + results.length + " docs" : "doc";
- resultsOutput.push("
")
- resultsOutput.push("
");
- $("#autocompleteResults").css("display","block");
- $("#autocompleteResults").html(resultsOutput.join(""));
- autoCompleteShowing = true;
- } else {
- $("#autocompleteResults").css("display","none");
- $("#autocompleteResults").html("");
- autoCompleteShowing = false;
- }
- lastSearch = searchVal;
- } // if searchVal != lastSearch
- });
-}
-
-function queryString()
-{
- var vars = [], hash;
- var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
- for(var i = 0; i < hashes.length; i++)
- {
- hash = hashes[i].split('=');
- vars.push(hash[0]);
- vars[hash[0]] = hash[1];
}
- return vars;
-}
+ let rows = []
+ if (results.length > 0) {
+ results.sort((a, b) => b.score - a.score);
+ const match = new RegExp(`(${searchVal})`, "gi");
+ const highlight = function (/* String */ content) {
+ return content.replace(match, "