Commit ad589edf authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

Merge branch 'master' of git.purrdata.net:jwilkes/purr-data

parents 2bd57a37 214839f0
Pipeline #3496 canceled with stage
......@@ -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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment