diff --git a/doc/conf.py b/doc/conf.py index 19b32a84f..14a46339d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -2,6 +2,7 @@ # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import os.path # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information @@ -78,6 +79,8 @@ html_last_updated_fmt = "" html_show_copyright = False +html_search_scorer = os.path.join(os.path.dirname(__file__), "searchscorer.js") + spelling_lang = "en_GB" spelling_filters = ["enchant.tokenize.MentionFilter"] spelling_warning = True diff --git a/doc/searchscorer.js b/doc/searchscorer.js new file mode 100644 index 000000000..11018d7c2 --- /dev/null +++ b/doc/searchscorer.js @@ -0,0 +1,38 @@ +var Scorer = { + score: result => { + var [docName, title, anchor, descr, score, filename] = result + + // Deprioritize instrument details (but still include them in results) + if (docName.includes("instrument_details")) { + score -= 100000; + } + + // Deprioritize retrospective-notes heavily (but still include them in results) + if (docName.includes("retrospective-notes")) { + score -= 1000000; + } + + return score + }, + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, + 1: 5, + 2: -5, + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + + // query found in terms + term: 5, + partialTerm: 2, +};