Eagerly generate the underscore-less name to search on
Basically, it doesn't make sense to generate those things every time you search. That generates a bunch of stuff for the GC to clean up, when, if the user wanted to do another search, it would just need to re-do it again.
This commit is contained in:
parent
d7971e587c
commit
3f70bfa79c
1 changed files with 4 additions and 2 deletions
|
@ -1303,11 +1303,11 @@ function defocusSearchBar() {
|
||||||
|
|
||||||
if (searchWords[j].indexOf(split[i]) > -1 ||
|
if (searchWords[j].indexOf(split[i]) > -1 ||
|
||||||
searchWords[j].indexOf(val) > -1 ||
|
searchWords[j].indexOf(val) > -1 ||
|
||||||
searchWords[j].replace(/_/g, "").indexOf(val) > -1)
|
ty.nameWithoutUnderscores.indexOf(val) > -1)
|
||||||
{
|
{
|
||||||
// filter type: ... queries
|
// filter type: ... queries
|
||||||
if (typePassesFilter(typeFilter, ty.ty) && results[fullId] === undefined) {
|
if (typePassesFilter(typeFilter, ty.ty) && results[fullId] === undefined) {
|
||||||
index = searchWords[j].replace(/_/g, "").indexOf(val);
|
index = ty.nameWithoutUnderscores.indexOf(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((lev = levenshtein(searchWords[j], val)) <= MAX_LEV_DISTANCE) {
|
if ((lev = levenshtein(searchWords[j], val)) <= MAX_LEV_DISTANCE) {
|
||||||
|
@ -1860,6 +1860,7 @@ function defocusSearchBar() {
|
||||||
parent: undefined,
|
parent: undefined,
|
||||||
type: null,
|
type: null,
|
||||||
id: "",
|
id: "",
|
||||||
|
nameWithoutUnderscores: crate.replace(/_/g, ""),
|
||||||
};
|
};
|
||||||
crateRow.id = generateId(crateRow);
|
crateRow.id = generateId(crateRow);
|
||||||
searchIndex.push(crateRow);
|
searchIndex.push(crateRow);
|
||||||
|
@ -1909,6 +1910,7 @@ function defocusSearchBar() {
|
||||||
parent: itemParentIdxs[i] > 0 ? paths[itemParentIdxs[i] - 1] : undefined,
|
parent: itemParentIdxs[i] > 0 ? paths[itemParentIdxs[i] - 1] : undefined,
|
||||||
type: itemFunctionSearchTypes[i],
|
type: itemFunctionSearchTypes[i],
|
||||||
id: "",
|
id: "",
|
||||||
|
nameWithoutUnderscores: itemNames[i].replace(/_/g, ""),
|
||||||
};
|
};
|
||||||
row.id = generateId(row);
|
row.id = generateId(row);
|
||||||
searchIndex.push(row);
|
searchIndex.push(row);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue