@@ -4368,27 +4368,26 @@ class DocSearch {
43684368 *
43694369 * The `results` map contains information which will be used to sort the search results:
43704370 *
4371- * * `fullId` is a `string `` used as the key of the object we use for the `results` map.
4371+ * * `fullId` is an `integer `` used as the key of the object we use for the `results` map.
43724372 * * `id` is the index in the `searchIndex` array for this element.
43734373 * * `index` is an `integer`` used to sort by the position of the word in the item's name.
43744374 * * `dist` is the main metric used to sort the search results.
43754375 * * `path_dist` is zero if a single-component search query is used, otherwise it's the
43764376 * distance computed for everything other than the last path component.
43774377 *
43784378 * @param {rustdoc.Results } results
4379- * @param {string } fullId
4379+ * @param {number } fullId
43804380 * @param {number } id
43814381 * @param {number } index
43824382 * @param {number } dist
43834383 * @param {number } path_dist
4384+ * @param {number } maxEditDistance
43844385 */
4385- // @ts -expect-error
43864386 function addIntoResults ( results , fullId , id , index , dist , path_dist , maxEditDistance ) {
43874387 if ( dist <= maxEditDistance || index !== - 1 ) {
43884388 if ( results . has ( fullId ) ) {
43894389 const result = results . get ( fullId ) ;
4390- // @ts -expect-error
4391- if ( result . dontValidate || result . dist <= dist ) {
4390+ if ( result === undefined || result . dontValidate || result . dist <= dist ) {
43924391 return ;
43934392 }
43944393 }
@@ -4456,7 +4455,7 @@ class DocSearch {
44564455 }
44574456
44584457 results . max_dist = Math . max ( results . max_dist || 0 , tfpDist ) ;
4459- addIntoResults ( results , row . id . toString ( ) , pos , 0 , tfpDist , 0 , Number . MAX_VALUE ) ;
4458+ addIntoResults ( results , row . id , pos , 0 , tfpDist , 0 , Number . MAX_VALUE ) ;
44604459 }
44614460
44624461 /**
@@ -4507,22 +4506,21 @@ class DocSearch {
45074506
45084507 let pathDist = 0 ;
45094508 if ( elem . fullPath . length > 1 ) {
4510- // @ts -expect-error
4511- pathDist = checkPath ( elem . pathWithoutLast , row ) ;
4512- if ( pathDist === null ) {
4513- return ;
4509+
4510+ const maybePathDist = checkPath ( elem . pathWithoutLast , row ) ;
4511+ if ( maybePathDist === null ) {
4512+ return
45144513 }
4514+ pathDist = maybePathDist ;
45154515 }
45164516
45174517 if ( parsedQuery . literalSearch ) {
45184518 if ( row . word === elem . pathLast ) {
4519- // @ts -expect-error
4520- addIntoResults ( results_others , row . id , id , 0 , 0 , pathDist ) ;
4519+ addIntoResults ( results_others , row . id , id , 0 , 0 , pathDist , 0 ) ;
45214520 }
45224521 } else {
45234522 addIntoResults (
45244523 results_others ,
4525- // @ts -expect-error
45264524 row . id ,
45274525 id ,
45284526 row . normalizedName . indexOf ( elem . normalizedPathLast ) ,
@@ -4570,7 +4568,6 @@ class DocSearch {
45704568 const maxDist = results_in_args . size < MAX_RESULTS ?
45714569 ( tfpDist + 1 ) :
45724570 results_in_args . max_dist ;
4573- // @ts -expect-error
45744571 addIntoResults ( results_in_args , row . id , i , - 1 , tfpDist , 0 , maxDist ) ;
45754572 }
45764573 if ( returned ) {
@@ -4581,7 +4578,6 @@ class DocSearch {
45814578 const maxDist = results_returned . size < MAX_RESULTS ?
45824579 ( tfpDist + 1 ) :
45834580 results_returned . max_dist ;
4584- // @ts -expect-error
45854581 addIntoResults ( results_returned , row . id , i , - 1 , tfpDist , 0 , maxDist ) ;
45864582 }
45874583 }
0 commit comments