File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Sphinx build info version 1
2
2
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3
- config: 796b86c2d1ca34872f8045bd78ec5d8e
3
+ config: e31fa0e4fc4bc8d7bdd9f7e8704312f6
4
4
tags: 645f666f9bcd5a90fca523b33c5a78b7
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ const Search = {
178
178
179
179
htmlToText : ( htmlString , anchor ) => {
180
180
const htmlElement = new DOMParser ( ) . parseFromString ( htmlString , 'text/html' ) ;
181
- for ( const removalQuery of [ ".headerlinks " , "script" , "style" ] ) {
181
+ for ( const removalQuery of [ ".headerlink " , "script" , "style" ] ) {
182
182
htmlElement . querySelectorAll ( removalQuery ) . forEach ( ( el ) => { el . remove ( ) } ) ;
183
183
}
184
184
if ( anchor ) {
@@ -328,13 +328,14 @@ const Search = {
328
328
for ( const [ title , foundTitles ] of Object . entries ( allTitles ) ) {
329
329
if ( title . toLowerCase ( ) . trim ( ) . includes ( queryLower ) && ( queryLower . length >= title . length / 2 ) ) {
330
330
for ( const [ file , id ] of foundTitles ) {
331
- let score = Math . round ( 100 * queryLower . length / title . length )
331
+ const score = Math . round ( Scorer . title * queryLower . length / title . length ) ;
332
+ const boost = titles [ file ] === title ? 1 : 0 ; // add a boost for document titles
332
333
normalResults . push ( [
333
334
docNames [ file ] ,
334
335
titles [ file ] !== title ? `${ titles [ file ] } > ${ title } ` : title ,
335
336
id !== null ? "#" + id : "" ,
336
337
null ,
337
- score ,
338
+ score + boost ,
338
339
filenames [ file ] ,
339
340
] ) ;
340
341
}
You can’t perform that action at this time.
0 commit comments