1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-10-04 00:51:52 +02:00

bundle pre-release

This commit is contained in:
Thomas Wilkerling
2025-03-07 17:44:10 +01:00
parent 5bcbc72dac
commit 25e4b5d712
219 changed files with 44901 additions and 16106 deletions

View File

@@ -1,36 +1,44 @@
// TODO return promises instead of inner await
import { IndexInterface, DocumentInterface } from "./type.js";
import Index from "./index.js";
import Document from "./document.js";
import { create_object, is_string } from "./common.js";
function async(callback, self, field, key, index_doc, index, data, on_done) {
setTimeout(function () {
//setTimeout(function(){
const res = callback(field ? field + "." + key : key, JSON.stringify(data));
const res = callback(field ? field + "." + key : key, JSON.stringify(data));
// await isn't supported by ES5
// await isn't supported by ES5
if (res && res.then) {
if (res && res.then) {
res.then(function () {
self.export(callback, self, field, index_doc, index + 1, on_done);
});
} else {
res.then(function () {
self.export(callback, self, field, index_doc, index + 1, on_done);
}
});
});
} else {
self.export(callback, self, field, index_doc, index + 1, on_done);
}
//});
}
/**
* @this IndexInterface
* @param callback
* @param self
* @param field
* @param index_doc
* @param index
* @param on_done
* @this {Index|Document}
*/
export function exportIndex(callback, self, field, index_doc, index, on_done) {
let return_value = /* append: */ /* skip update: */ /* skip_update: */ /* skip post-processing: */!0;
let return_value = /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */ // splice:
!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/;
if ('undefined' == typeof on_done) {
return_value = new Promise(resolve => {
on_done = resolve;
@@ -51,13 +59,13 @@ export function exportIndex(callback, self, field, index_doc, index, on_done) {
data = create_object();
for (let key in this.register) {
for (let key of this.reg.keys()) {
data[key] = 1;
}
} else {
data = this.register;
data = this.reg;
}
break;
@@ -100,7 +108,7 @@ export function exportIndex(callback, self, field, index_doc, index, on_done) {
}
/**
* @this IndexInterface
* @this Index
*/
export function importIndex(key, data) {
@@ -126,8 +134,8 @@ export function importIndex(key, data) {
// fastupdate isn't supported by import
this.fastupdate = /* normalize: */ /* collapse: */ /* normalize: */ /* collapse: */ /* normalize: */ /* collapse: */ /* normalize: */ /* collapse: */ /* collapse: */!1;
this.register = data;
this.fastupdate = /* suggest */ /* append: */ /* enrich */!1;
this.reg = data;
break;
case "map":
@@ -143,7 +151,7 @@ export function importIndex(key, data) {
}
/**
* @this DocumentInterface
* @this Document
*/
export function exportDocument(callback, self, field, index_doc, index, on_done) {
@@ -165,16 +173,16 @@ export function exportDocument(callback, self, field, index_doc, index, on_done)
self = this;
setTimeout(function () {
//setTimeout(function(){
if (!idx.export(callback, self, index ? field /*.replace(":", "-")*/ : "", index_doc, index++, on_done)) {
if (!idx.export(callback, self, index ? field /*.replace(":", "-")*/ : "", index_doc, index++, on_done)) {
index_doc++;
index = 1;
index_doc++;
index = 1;
self.export(callback, self, field, index_doc, index, on_done);
}
});
self.export(callback, self, field, index_doc, index, on_done);
}
//});
} else {
let key, data;
@@ -214,7 +222,7 @@ export function exportDocument(callback, self, field, index_doc, index, on_done)
}
/**
* @this DocumentInterface
* @this Document
*/
export function importDocument(key, data) {
@@ -241,12 +249,12 @@ export function importDocument(key, data) {
// fastupdate isn't supported by import
this.fastupdate = !1;
this.register = data;
this.reg = data;
for (let i = 0, index; i < this.field.length; i++) {
index = this.index[this.field[i]];
index.register = data;
index.reg = data;
index.fastupdate = !1;
}