From 0b10467bf1bed731ba1c965b64b08a3bad444883 Mon Sep 17 00:00:00 2001 From: Gabriela Bittencourt <gabrielabittencourt00@gmail.com> Date: Sun, 28 Mar 2021 23:41:43 +0200 Subject: [PATCH] Add path importance to the ranking criteria Core documentation (inside pd-l2ork/doc/...) should be ranked before external libraries. Add a multiplier to increase the score of files inside that folder. --- pd/nw/dialog_search.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html index 0d49f09f6..0a2b87bb8 100644 --- a/pd/nw/dialog_search.html +++ b/pd/nw/dialog_search.html @@ -865,6 +865,13 @@ function doc_search() { 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); -- GitLab