Skip to content

Commit 915e580

Browse files
committed
docs search function: give a boost to built-in types and functions
1 parent 96b7a2e commit 915e580

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Doc/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,8 @@
575575
'<meta property="og:image:width" content="200">',
576576
'<meta property="og:image:height" content="200">',
577577
)
578+
579+
# Options to adjust search results sorting
580+
# ----------------------------------------
581+
582+
html_search_scorer = "search_scorer.js"

Doc/search_scorer.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var Scorer = {
2+
score: function (result) {
3+
let [docname, title, anchor, descr, score, filename] = result;
4+
if (docname == "library/stdtypes" || docname == "library/functions") {
5+
score += 10;
6+
}
7+
return score;
8+
},
9+
10+
objPrio: {
11+
0: 15,
12+
1: 5,
13+
2: -5,
14+
},
15+
objPrioDefault: 0,
16+
17+
objNameMatch: 20,
18+
objPartialMatch: 6,
19+
20+
title: 15,
21+
partialTitle: 7,
22+
term: 5,
23+
partialTerm: 2,
24+
};

0 commit comments

Comments
 (0)