@@ -4369,27 +4369,26 @@ class DocSearch {
43694369 *
43704370 * The `results` map contains information which will be used to sort the search results:
43714371 *
4372- * * `fullId` is a `string `` used as the key of the object we use for the `results` map.
4372+ * * `fullId` is an `integer `` used as the key of the object we use for the `results` map.
43734373 * * `id` is the index in the `searchIndex` array for this element.
43744374 * * `index` is an `integer`` used to sort by the position of the word in the item's name.
43754375 * * `dist` is the main metric used to sort the search results.
43764376 * * `path_dist` is zero if a single-component search query is used, otherwise it's the
43774377 * distance computed for everything other than the last path component.
43784378 *
43794379 * @param {rustdoc.Results } results
4380- * @param {string } fullId
4380+ * @param {number } fullId
43814381 * @param {number } id
43824382 * @param {number } index
43834383 * @param {number } dist
43844384 * @param {number } path_dist
4385+ * @param {number } maxEditDistance
43854386 */
4386- // @ts -expect-error
43874387 function addIntoResults ( results , fullId , id , index , dist , path_dist , maxEditDistance ) {
43884388 if ( dist <= maxEditDistance || index !== - 1 ) {
43894389 if ( results . has ( fullId ) ) {
43904390 const result = results . get ( fullId ) ;
4391- // @ts -expect-error
4392- if ( result . dontValidate || result . dist <= dist ) {
4391+ if ( result === undefined || result . dontValidate || result . dist <= dist ) {
43934392 return ;
43944393 }
43954394 }
@@ -4457,7 +4456,7 @@ class DocSearch {
44574456 }
44584457
44594458 results . max_dist = Math . max ( results . max_dist || 0 , tfpDist ) ;
4460- addIntoResults ( results , row . id . toString ( ) , pos , 0 , tfpDist , 0 , Number . MAX_VALUE ) ;
4459+ addIntoResults ( results , row . id , pos , 0 , tfpDist , 0 , Number . MAX_VALUE ) ;
44614460 }
44624461
44634462 /**
@@ -4508,22 +4507,21 @@ class DocSearch {
45084507
45094508 let pathDist = 0 ;
45104509 if ( elem . fullPath . length > 1 ) {
4511- // @ts -expect-error
4512- pathDist = checkPath ( elem . pathWithoutLast , row ) ;
4513- if ( pathDist === null ) {
4514- return ;
4510+
4511+ const maybePathDist = checkPath ( elem . pathWithoutLast , row ) ;
4512+ if ( maybePathDist === null ) {
4513+ return
45154514 }
4515+ pathDist = maybePathDist ;
45164516 }
45174517
45184518 if ( parsedQuery . literalSearch ) {
45194519 if ( row . word === elem . pathLast ) {
4520- // @ts -expect-error
4521- addIntoResults ( results_others , row . id , id , 0 , 0 , pathDist ) ;
4520+ addIntoResults ( results_others , row . id , id , 0 , 0 , pathDist , 0 ) ;
45224521 }
45234522 } else {
45244523 addIntoResults (
45254524 results_others ,
4526- // @ts -expect-error
45274525 row . id ,
45284526 id ,
45294527 row . normalizedName . indexOf ( elem . normalizedPathLast ) ,
@@ -4571,7 +4569,6 @@ class DocSearch {
45714569 const maxDist = results_in_args . size < MAX_RESULTS ?
45724570 ( tfpDist + 1 ) :
45734571 results_in_args . max_dist ;
4574- // @ts -expect-error
45754572 addIntoResults ( results_in_args , row . id , i , - 1 , tfpDist , 0 , maxDist ) ;
45764573 }
45774574 if ( returned ) {
@@ -4582,7 +4579,6 @@ class DocSearch {
45824579 const maxDist = results_returned . size < MAX_RESULTS ?
45834580 ( tfpDist + 1 ) :
45844581 results_returned . max_dist ;
4585- // @ts -expect-error
45864582 addIntoResults ( results_returned , row . id , i , - 1 , tfpDist , 0 , maxDist ) ;
45874583 }
45884584 }
0 commit comments