diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html index c882574b61da563435bc255c2a93365b73bf625e..d3534adb89595ec19bf4c47e5863b1c1d1fd8453 100644 --- a/pd/nw/dialog_search.html +++ b/pd/nw/dialog_search.html @@ -784,6 +784,10 @@ function add_events() { } }); + document.getElementById("search_text").addEventListener("keyup", + function() { + doc_search(); + }); document.getElementById("search_text").addEventListener("search", function() { doc_search(); @@ -858,7 +862,20 @@ function doc_search() { clear_results(); text_elem.blur(); toc_bookmark_status(false); - results = index.search(search_text); + results = index.search(search_text, { + fields: { + title: {boost: 64, expand: true}, + keywords: {boost: 8, expand: true}, + description: {boost: 1} + } + }); + // Increase priority of pd-l2ork docs over externals docs + for (i = 0; i < results.length; i++) { + if (results[i].ref.match(/.*\/pd-l2ork\/doc\/.*/) != null) { + results[i].score *= 5; + } + } + results.sort(function(a, b) { return b.score - a.score; }); for (i = 0; i < results.length; i++) { doc = index.documentStore.getDoc(results[i].ref); display_doc(doc); @@ -888,7 +905,8 @@ function doc_search() { <input type="search" name="search_text" id="search_text" - data-i18n="[title]search.search"> + data-i18n="[title]search.search" + autocomplete="off"> <input type="image" style="vertical-align:middle;" src="folder.svg" id="file_browser_button"