@@ -1097,7 +1097,7 @@ class RoaringBitmapBits {
1097
1097
1098
1098
1099
1099
class DocSearch {
1100
- constructor ( rawSearchIndex , rootPath ) {
1100
+ constructor ( rawSearchIndex , rootPath , searchState ) {
1101
1101
/**
1102
1102
* @type {Map<String, RoaringBitmap> }
1103
1103
*/
@@ -1119,6 +1119,7 @@ class DocSearch {
1119
1119
this . typeNameIdMap = new Map ( ) ;
1120
1120
this . ALIASES = new Map ( ) ;
1121
1121
this . rootPath = rootPath ;
1122
+ this . searchState = searchState ;
1122
1123
1123
1124
/**
1124
1125
* Special type name IDs for searching by array.
@@ -1729,7 +1730,7 @@ class DocSearch {
1729
1730
}
1730
1731
}
1731
1732
currentIndex += itemTypes . length ;
1732
- searchState . descShards . set ( crate , descShardList ) ;
1733
+ this . searchState . descShards . set ( crate , descShardList ) ;
1733
1734
}
1734
1735
// Drop the (rather large) hash table used for reusing function items
1735
1736
this . TYPES_POOL = new Map ( ) ;
@@ -2869,7 +2870,7 @@ class DocSearch {
2869
2870
2870
2871
const fetchDesc = alias => {
2871
2872
return this . searchIndexEmptyDesc . get ( alias . crate ) . contains ( alias . bitIndex ) ?
2872
- "" : searchState . loadDesc ( alias ) ;
2873
+ "" : this . searchState . loadDesc ( alias ) ;
2873
2874
} ;
2874
2875
const [ crateDescs , descs ] = await Promise . all ( [
2875
2876
Promise . all ( crateAliases . map ( fetchDesc ) ) ,
@@ -3302,7 +3303,7 @@ class DocSearch {
3302
3303
const descs = await Promise . all ( list . map ( result => {
3303
3304
return this . searchIndexEmptyDesc . get ( result . crate ) . contains ( result . bitIndex ) ?
3304
3305
"" :
3305
- searchState . loadDesc ( result ) ;
3306
+ this . searchState . loadDesc ( result ) ;
3306
3307
} ) ) ;
3307
3308
for ( const [ i , result ] of list . entries ( ) ) {
3308
3309
result . desc = descs [ i ] ;
@@ -3903,9 +3904,9 @@ function updateCrate(ev) {
3903
3904
function initSearch ( searchIndx ) {
3904
3905
rawSearchIndex = searchIndx ;
3905
3906
if ( typeof window !== "undefined" ) {
3906
- docSearch = new DocSearch ( rawSearchIndex , ROOT_PATH ) ;
3907
+ docSearch = new DocSearch ( rawSearchIndex , ROOT_PATH , searchState ) ;
3907
3908
} else if ( typeof exports !== "undefined" ) {
3908
- docSearch = new DocSearch ( rawSearchIndex , ROOT_PATH ) ;
3909
+ docSearch = new DocSearch ( rawSearchIndex , ROOT_PATH , searchState ) ;
3909
3910
exports . docSearch = docSearch ;
3910
3911
exports . parseQuery = DocSearch . parseQuery ;
3911
3912
}
0 commit comments