1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-29 23:08:59 +02:00

fix imports

This commit is contained in:
Thomas Wilkerling
2025-03-12 15:07:16 +01:00
parent 59e95a2951
commit 4fe11882ca
53 changed files with 1918 additions and 1843 deletions

View File

@@ -49,7 +49,8 @@ export default function Document(options) {
this.cache = (tmp = options.cache || null) && new Cache(tmp);
// do not apply cache again for the indexes since .searchCache()
// is just a wrapper over .search()
options.cache = /* suggest */ /* append: */ /* enrich */!1;
options.cache = /* suggest */ /* append: */
/* enrich */!1;
this.worker = options.worker;
@@ -99,7 +100,21 @@ export default function Document(options) {
}
}
options.db && this.mount(options.db);
if (this.worker) {
const promises = [];
for (const index of this.index.values()) {
index.worker.then && promises.push(index.worker);
}
if (promises.length) {
const self = this;
return Promise.all(promises).then(function () {
return self;
});
}
} else {
options.db && this.mount(options.db);
}
}
Document.prototype.mount = function (db) {
@@ -209,8 +224,9 @@ function parse_descriptor(options, document) {
if (this.worker) {
const worker = new WorkerIndex(opt);
index.set(key, worker);
if (!worker.worker) {
if (worker.worker) {
index.set(key, worker);
} else {
// fallback when not supported
this.worker = !1;
}