@@ -4368,27 +4368,26 @@ class DocSearch {
4368
4368
*
4369
4369
* The `results` map contains information which will be used to sort the search results:
4370
4370
*
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.
4372
4372
* * `id` is the index in the `searchIndex` array for this element.
4373
4373
* * `index` is an `integer`` used to sort by the position of the word in the item's name.
4374
4374
* * `dist` is the main metric used to sort the search results.
4375
4375
* * `path_dist` is zero if a single-component search query is used, otherwise it's the
4376
4376
* distance computed for everything other than the last path component.
4377
4377
*
4378
4378
* @param {rustdoc.Results } results
4379
- * @param {string } fullId
4379
+ * @param {number } fullId
4380
4380
* @param {number } id
4381
4381
* @param {number } index
4382
4382
* @param {number } dist
4383
4383
* @param {number } path_dist
4384
+ * @param {number } maxEditDistance
4384
4385
*/
4385
- // @ts -expect-error
4386
4386
function addIntoResults ( results , fullId , id , index , dist , path_dist , maxEditDistance ) {
4387
4387
if ( dist <= maxEditDistance || index !== - 1 ) {
4388
4388
if ( results . has ( fullId ) ) {
4389
4389
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 ) {
4392
4391
return ;
4393
4392
}
4394
4393
}
@@ -4456,7 +4455,7 @@ class DocSearch {
4456
4455
}
4457
4456
4458
4457
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 ) ;
4460
4459
}
4461
4460
4462
4461
/**
@@ -4507,22 +4506,21 @@ class DocSearch {
4507
4506
4508
4507
let pathDist = 0 ;
4509
4508
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
4514
4513
}
4514
+ pathDist = maybePathDist ;
4515
4515
}
4516
4516
4517
4517
if ( parsedQuery . literalSearch ) {
4518
4518
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 ) ;
4521
4520
}
4522
4521
} else {
4523
4522
addIntoResults (
4524
4523
results_others ,
4525
- // @ts -expect-error
4526
4524
row . id ,
4527
4525
id ,
4528
4526
row . normalizedName . indexOf ( elem . normalizedPathLast ) ,
@@ -4570,7 +4568,6 @@ class DocSearch {
4570
4568
const maxDist = results_in_args . size < MAX_RESULTS ?
4571
4569
( tfpDist + 1 ) :
4572
4570
results_in_args . max_dist ;
4573
- // @ts -expect-error
4574
4571
addIntoResults ( results_in_args , row . id , i , - 1 , tfpDist , 0 , maxDist ) ;
4575
4572
}
4576
4573
if ( returned ) {
@@ -4581,7 +4578,6 @@ class DocSearch {
4581
4578
const maxDist = results_returned . size < MAX_RESULTS ?
4582
4579
( tfpDist + 1 ) :
4583
4580
results_returned . max_dist ;
4584
- // @ts -expect-error
4585
4581
addIntoResults ( results_returned , row . id , i , - 1 , tfpDist , 0 , maxDist ) ;
4586
4582
}
4587
4583
}
0 commit comments