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