Revert "feat: improve indexing performance"

This reverts commit 0c7f058051.
This commit is contained in:
thecodrr
2020-11-16 14:59:15 +05:00
parent 8d3076460d
commit 20a3d1ab20
4 changed files with 10 additions and 18 deletions

View File

@@ -7,18 +7,16 @@ import IndexedCollection from "./indexed-collection";
export default class CachedCollection extends IndexedCollection {
async init() {
const store = new PersistentCachedMap(this.storeKey, this.storage);
const index = new PersistentCachedMap(`${this.type}Index`, this.storage);
const store = new PersistentCachedMap(`${this.type}Store`, this.storage);
await index.init();
await store.init();
this.search = new HyperSearch({
schema: getSchema(this.type),
tokenizer: "forward",
index,
store,
onIndexUpdated: async () => {
await this.storage.write(this.indexKey, this.search.indexer.export());
},
});
const index = await this.storage.read(this.indexKey);
this.search.indexer.import(index);
}
exists(id) {