Use a number for row.id, instead of a string
There's no reason for it to be a string, since it's only used for de-duplicating the results arrays anyhow.
This commit is contained in:
parent
0bfd142926
commit
f57d71533e
1 changed files with 5 additions and 11 deletions
|
@ -1833,18 +1833,12 @@ function defocusSearchBar() {
|
||||||
showResults(execSearch(query, index, filterCrates));
|
showResults(execSearch(query, index, filterCrates));
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateId(ty) {
|
|
||||||
if (ty.parent && ty.parent.name) {
|
|
||||||
return itemTypes[ty.ty] + ty.path + ty.parent.name + ty.name;
|
|
||||||
}
|
|
||||||
return itemTypes[ty.ty] + ty.path + ty.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildIndex(rawSearchIndex) {
|
function buildIndex(rawSearchIndex) {
|
||||||
searchIndex = [];
|
searchIndex = [];
|
||||||
var searchWords = [];
|
var searchWords = [];
|
||||||
var i;
|
var i;
|
||||||
var currentIndex = 0;
|
var currentIndex = 0;
|
||||||
|
var id = 0;
|
||||||
|
|
||||||
for (var crate in rawSearchIndex) {
|
for (var crate in rawSearchIndex) {
|
||||||
if (!hasOwnProperty(rawSearchIndex, crate)) { continue; }
|
if (!hasOwnProperty(rawSearchIndex, crate)) { continue; }
|
||||||
|
@ -1866,10 +1860,10 @@ function defocusSearchBar() {
|
||||||
desc: rawSearchIndex[crate].doc,
|
desc: rawSearchIndex[crate].doc,
|
||||||
parent: undefined,
|
parent: undefined,
|
||||||
type: null,
|
type: null,
|
||||||
id: "",
|
id: id,
|
||||||
nameWithoutUnderscores: nameWithoutUnderscores,
|
nameWithoutUnderscores: nameWithoutUnderscores,
|
||||||
};
|
};
|
||||||
crateRow.id = generateId(crateRow);
|
id += 1;
|
||||||
searchIndex.push(crateRow);
|
searchIndex.push(crateRow);
|
||||||
currentIndex += 1;
|
currentIndex += 1;
|
||||||
|
|
||||||
|
@ -1921,10 +1915,10 @@ function defocusSearchBar() {
|
||||||
desc: itemDescs[i],
|
desc: itemDescs[i],
|
||||||
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,
|
||||||
nameWithoutUnderscores: nameWithoutUnderscores,
|
nameWithoutUnderscores: nameWithoutUnderscores,
|
||||||
};
|
};
|
||||||
row.id = generateId(row);
|
id += 1;
|
||||||
searchIndex.push(row);
|
searchIndex.push(row);
|
||||||
if (typeof row.name === "string") {
|
if (typeof row.name === "string") {
|
||||||
var word = row.name.toLowerCase();
|
var word = row.name.toLowerCase();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue