@@ -1304,11 +1304,11 @@ function defocusSearchBar() {
13041304
13051305 if ( searchWords [ j ] . indexOf ( split [ i ] ) > - 1 ||
13061306 searchWords [ j ] . indexOf ( val ) > - 1 ||
1307- ty . nameWithoutUnderscores . indexOf ( val ) > - 1 )
1307+ ty . normalizedName . indexOf ( val ) > - 1 )
13081308 {
13091309 // filter type: ... queries
13101310 if ( typePassesFilter ( typeFilter , ty . ty ) && results [ fullId ] === undefined ) {
1311- index = ty . nameWithoutUnderscores . indexOf ( val ) ;
1311+ index = ty . normalizedName . indexOf ( val ) ;
13121312 }
13131313 }
13141314 if ( ( lev = levenshtein ( searchWords [ j ] , val ) ) <= MAX_LEV_DISTANCE ) {
@@ -1846,7 +1846,7 @@ function defocusSearchBar() {
18461846 var crateSize = 0 ;
18471847
18481848 searchWords . push ( crate ) ;
1849- var nameWithoutUnderscores = crate . indexOf ( "_" ) === - 1
1849+ var normalizedName = crate . indexOf ( "_" ) === - 1
18501850 ? crate
18511851 : crate . replace ( / _ / g, "" ) ;
18521852 // This object should have exactly the same set of fields as the "row"
@@ -1861,7 +1861,7 @@ function defocusSearchBar() {
18611861 parent : undefined ,
18621862 type : null ,
18631863 id : id ,
1864- nameWithoutUnderscores : nameWithoutUnderscores ,
1864+ normalizedName : normalizedName ,
18651865 } ;
18661866 id += 1 ;
18671867 searchIndex . push ( crateRow ) ;
@@ -1904,9 +1904,16 @@ function defocusSearchBar() {
19041904 for ( i = 0 ; i < len ; ++ i ) {
19051905 // This object should have exactly the same set of fields as the "crateRow"
19061906 // 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, "" ) ;
19101917 var row = {
19111918 crate : crate ,
19121919 ty : itemTypes [ i ] ,
@@ -1916,16 +1923,10 @@ function defocusSearchBar() {
19161923 parent : itemParentIdxs [ i ] > 0 ? paths [ itemParentIdxs [ i ] - 1 ] : undefined ,
19171924 type : itemFunctionSearchTypes [ i ] ,
19181925 id : id ,
1919- nameWithoutUnderscores : nameWithoutUnderscores ,
1926+ normalizedName : normalizedName ,
19201927 } ;
19211928 id += 1 ;
19221929 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- }
19291930 lastPath = row . path ;
19301931 crateSize += 1 ;
19311932 }
0 commit comments