@@ -1304,11 +1304,11 @@ function defocusSearchBar() {
1304
1304
1305
1305
if ( searchWords [ j ] . indexOf ( split [ i ] ) > - 1 ||
1306
1306
searchWords [ j ] . indexOf ( val ) > - 1 ||
1307
- ty . nameWithoutUnderscores . indexOf ( val ) > - 1 )
1307
+ ty . normalizedName . indexOf ( val ) > - 1 )
1308
1308
{
1309
1309
// filter type: ... queries
1310
1310
if ( typePassesFilter ( typeFilter , ty . ty ) && results [ fullId ] === undefined ) {
1311
- index = ty . nameWithoutUnderscores . indexOf ( val ) ;
1311
+ index = ty . normalizedName . indexOf ( val ) ;
1312
1312
}
1313
1313
}
1314
1314
if ( ( lev = levenshtein ( searchWords [ j ] , val ) ) <= MAX_LEV_DISTANCE ) {
@@ -1846,7 +1846,7 @@ function defocusSearchBar() {
1846
1846
var crateSize = 0 ;
1847
1847
1848
1848
searchWords . push ( crate ) ;
1849
- var nameWithoutUnderscores = crate . indexOf ( "_" ) === - 1
1849
+ var normalizedName = crate . indexOf ( "_" ) === - 1
1850
1850
? crate
1851
1851
: crate . replace ( / _ / g, "" ) ;
1852
1852
// This object should have exactly the same set of fields as the "row"
@@ -1861,7 +1861,7 @@ function defocusSearchBar() {
1861
1861
parent : undefined ,
1862
1862
type : null ,
1863
1863
id : id ,
1864
- nameWithoutUnderscores : nameWithoutUnderscores ,
1864
+ normalizedName : normalizedName ,
1865
1865
} ;
1866
1866
id += 1 ;
1867
1867
searchIndex . push ( crateRow ) ;
@@ -1904,9 +1904,16 @@ function defocusSearchBar() {
1904
1904
for ( i = 0 ; i < len ; ++ i ) {
1905
1905
// This object should have exactly the same set of fields as the "crateRow"
1906
1906
// object defined above.
1907
- var nameWithoutUnderscores = itemNames [ i ] . indexOf ( "_" ) === - 1
1908
- ? itemNames [ i ]
1909
- : itemNames [ i ] . replace ( / _ / g, "" ) ;
1907
+ if ( typeof itemNames [ i ] === "string" ) {
1908
+ var word = itemNames [ i ] . toLowerCase ( ) ;
1909
+ searchWords . push ( word ) ;
1910
+ } else {
1911
+ var word = "" ;
1912
+ searchWords . push ( "" ) ;
1913
+ }
1914
+ var normalizedName = word . indexOf ( "_" ) === - 1
1915
+ ? word
1916
+ : word . replace ( / _ / g, "" ) ;
1910
1917
var row = {
1911
1918
crate : crate ,
1912
1919
ty : itemTypes [ i ] ,
@@ -1916,16 +1923,10 @@ function defocusSearchBar() {
1916
1923
parent : itemParentIdxs [ i ] > 0 ? paths [ itemParentIdxs [ i ] - 1 ] : undefined ,
1917
1924
type : itemFunctionSearchTypes [ i ] ,
1918
1925
id : id ,
1919
- nameWithoutUnderscores : nameWithoutUnderscores ,
1926
+ normalizedName : normalizedName ,
1920
1927
} ;
1921
1928
id += 1 ;
1922
1929
searchIndex . push ( row ) ;
1923
- if ( typeof row . name === "string" ) {
1924
- var word = row . name . toLowerCase ( ) ;
1925
- searchWords . push ( word ) ;
1926
- } else {
1927
- searchWords . push ( "" ) ;
1928
- }
1929
1930
lastPath = row . path ;
1930
1931
crateSize += 1 ;
1931
1932
}
0 commit comments