Make nameWithoutUndescores lowercased
This basically fixes a search bug introduced by earlier changes.
This commit is contained in:
parent
f57d71533e
commit
8eba927a3e
1 changed files with 15 additions and 14 deletions
|
@ -1304,11 +1304,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 ||
|
||||||
ty.nameWithoutUnderscores.indexOf(val) > -1)
|
ty.normalizedName.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 = ty.nameWithoutUnderscores.indexOf(val);
|
index = ty.normalizedName.indexOf(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((lev = levenshtein(searchWords[j], val)) <= MAX_LEV_DISTANCE) {
|
if ((lev = levenshtein(searchWords[j], val)) <= MAX_LEV_DISTANCE) {
|
||||||
|
@ -1846,7 +1846,7 @@ function defocusSearchBar() {
|
||||||
var crateSize = 0;
|
var crateSize = 0;
|
||||||
|
|
||||||
searchWords.push(crate);
|
searchWords.push(crate);
|
||||||
var nameWithoutUnderscores = crate.indexOf("_") === -1
|
var normalizedName = crate.indexOf("_") === -1
|
||||||
? crate
|
? crate
|
||||||
: crate.replace(/_/g, "");
|
: crate.replace(/_/g, "");
|
||||||
// This object should have exactly the same set of fields as the "row"
|
// This object should have exactly the same set of fields as the "row"
|
||||||
|
@ -1861,7 +1861,7 @@ function defocusSearchBar() {
|
||||||
parent: undefined,
|
parent: undefined,
|
||||||
type: null,
|
type: null,
|
||||||
id: id,
|
id: id,
|
||||||
nameWithoutUnderscores: nameWithoutUnderscores,
|
normalizedName: normalizedName,
|
||||||
};
|
};
|
||||||
id += 1;
|
id += 1;
|
||||||
searchIndex.push(crateRow);
|
searchIndex.push(crateRow);
|
||||||
|
@ -1904,9 +1904,16 @@ function defocusSearchBar() {
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
// This object should have exactly the same set of fields as the "crateRow"
|
// This object should have exactly the same set of fields as the "crateRow"
|
||||||
// object defined above.
|
// object defined above.
|
||||||
var nameWithoutUnderscores = itemNames[i].indexOf("_") === -1
|
if (typeof itemNames[i] === "string") {
|
||||||
? itemNames[i]
|
var word = itemNames[i].toLowerCase();
|
||||||
: itemNames[i].replace(/_/g, "");
|
searchWords.push(word);
|
||||||
|
} else {
|
||||||
|
var word = "";
|
||||||
|
searchWords.push("");
|
||||||
|
}
|
||||||
|
var normalizedName = word.indexOf("_") === -1
|
||||||
|
? word
|
||||||
|
: word.replace(/_/g, "");
|
||||||
var row = {
|
var row = {
|
||||||
crate: crate,
|
crate: crate,
|
||||||
ty: itemTypes[i],
|
ty: itemTypes[i],
|
||||||
|
@ -1916,16 +1923,10 @@ 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,
|
id: id,
|
||||||
nameWithoutUnderscores: nameWithoutUnderscores,
|
normalizedName: normalizedName,
|
||||||
};
|
};
|
||||||
id += 1;
|
id += 1;
|
||||||
searchIndex.push(row);
|
searchIndex.push(row);
|
||||||
if (typeof row.name === "string") {
|
|
||||||
var word = row.name.toLowerCase();
|
|
||||||
searchWords.push(word);
|
|
||||||
} else {
|
|
||||||
searchWords.push("");
|
|
||||||
}
|
|
||||||
lastPath = row.path;
|
lastPath = row.path;
|
||||||
crateSize += 1;
|
crateSize += 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue