#118 - Improved caching

That will teach me to read documentation (it won't).
This commit is contained in:
Simon Cambier
2022-10-28 13:03:43 +02:00
parent 422f84c1cf
commit 9af71e3efc
4 changed files with 21 additions and 14 deletions

View File

@@ -89,12 +89,15 @@ export class SearchEngine {
}
/**
* Must be called when the background indexing is done,
* to load the freshest data into the main instance
* Loads the freshest indexed data into the main instance.
*/
public static swapEngines(): void {
;[this.engine, this.tmpEngine] = [this.tmpEngine, this.engine]
this.isIndexing.set(false)
public static loadTmpDataIntoMain(): void {
const tmpData = this.tmpEngine.minisearch.toJSON()
this.engine.minisearch = MiniSearch.loadJS(tmpData, minisearchOptions);
}
public static clearTmp():void {
this.tmpEngine.minisearch = new MiniSearch(minisearchOptions)
}
private minisearch: MiniSearch