@@ -1334,25 +1334,6 @@ function initSearch(rawSearchIndex) {
1334
1334
return 0 ;
1335
1335
} ) ;
1336
1336
1337
- let nameSplit = null ;
1338
- if ( parsedQuery . elems . length === 1 ) {
1339
- const hasPath = typeof parsedQuery . elems [ 0 ] . path === "undefined" ;
1340
- nameSplit = hasPath ? null : parsedQuery . elems [ 0 ] . path ;
1341
- }
1342
-
1343
- for ( const result of result_list ) {
1344
- // this validation does not make sense when searching by types
1345
- if ( result . dontValidate ) {
1346
- continue ;
1347
- }
1348
- const name = result . item . name . toLowerCase ( ) ,
1349
- path = result . item . path . toLowerCase ( ) ,
1350
- parent = result . item . parent ;
1351
-
1352
- if ( ! isType && ! validateResult ( name , path , nameSplit , parent ) ) {
1353
- result . id = - 1 ;
1354
- }
1355
- }
1356
1337
return transformResults ( result_list ) ;
1357
1338
}
1358
1339
@@ -2292,44 +2273,6 @@ function initSearch(rawSearchIndex) {
2292
2273
return ret ;
2293
2274
}
2294
2275
2295
- /**
2296
- * Validate performs the following boolean logic. For example:
2297
- * "File::open" will give IF A PARENT EXISTS => ("file" && "open")
2298
- * exists in (name || path || parent) OR => ("file" && "open") exists in
2299
- * (name || path )
2300
- *
2301
- * This could be written functionally, but I wanted to minimise
2302
- * functions on stack.
2303
- *
2304
- * @param {string } name - The name of the result
2305
- * @param {string } path - The path of the result
2306
- * @param {string } keys - The keys to be used (["file", "open"])
2307
- * @param {Object } parent - The parent of the result
2308
- *
2309
- * @return {boolean } - Whether the result is valid or not
2310
- */
2311
- function validateResult ( name , path , keys , parent , maxEditDistance ) {
2312
- if ( ! keys || ! keys . length ) {
2313
- return true ;
2314
- }
2315
- for ( const key of keys ) {
2316
- // each check is for validation so we negate the conditions and invalidate
2317
- if ( ! (
2318
- // check for an exact name match
2319
- name . indexOf ( key ) > - 1 ||
2320
- // then an exact path match
2321
- path . indexOf ( key ) > - 1 ||
2322
- // next if there is a parent, check for exact parent match
2323
- ( parent !== undefined && parent . name !== undefined &&
2324
- parent . name . toLowerCase ( ) . indexOf ( key ) > - 1 ) ||
2325
- // lastly check to see if the name was an editDistance match
2326
- editDistance ( name , key , maxEditDistance ) <= maxEditDistance ) ) {
2327
- return false ;
2328
- }
2329
- }
2330
- return true ;
2331
- }
2332
-
2333
2276
function nextTab ( direction ) {
2334
2277
const next = ( searchState . currentTab + direction + 3 ) % searchState . focusedByTab . length ;
2335
2278
searchState . focusedByTab [ searchState . currentTab ] = document . activeElement ;
0 commit comments