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