mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-10-01 23:56:41 +02:00
fix imports
This commit is contained in:
293
dist/flexsearch.compact.module.debug.js
vendored
293
dist/flexsearch.compact.module.debug.js
vendored
@@ -165,8 +165,8 @@ J.prototype.encode = function(a) {
|
||||
e && g && (e.length < this.minlength || this.filter && this.filter.has(e)) && (e = "");
|
||||
if (e && (this.mapper || this.dedupe && 1 < e.length)) {
|
||||
var d = "";
|
||||
for (let h = 0, k = "", m, l; h < e.length; h++) {
|
||||
m = e.charAt(h), m === k && this.dedupe || ((l = this.mapper && this.mapper.get(m)) || "" === l ? l === k && this.dedupe || !(k = l) || (d += l) : d += k = m);
|
||||
for (let h = 0, k = "", l, n; h < e.length; h++) {
|
||||
l = e.charAt(h), l === k && this.dedupe || ((n = this.mapper && this.mapper.get(l)) || "" === n ? n === k && this.dedupe || !(k = n) || (d += n) : d += k = l);
|
||||
}
|
||||
e = d;
|
||||
}
|
||||
@@ -184,40 +184,40 @@ const K = {normalize:function(a) {
|
||||
return a.toLowerCase();
|
||||
}, dedupe:!1};
|
||||
const L = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]);
|
||||
const M = new Map([["ai", "ei"], ["ae", "a"], ["oe", "o"], ["ue", "u"], ["sh", "s"], ["ch", "c"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), ha = [/([^aeo])h([aeo$])/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2"];
|
||||
const ia = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
|
||||
const M = new Map([["ai", "ei"], ["ae", "a"], ["oe", "o"], ["ue", "u"], ["sh", "s"], ["ch", "c"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), N = [/([^aeo])h([aeo$])/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2"];
|
||||
const ha = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6};
|
||||
const ia = /[\x00-\x7F]+/g;
|
||||
const ja = /[\x00-\x7F]+/g;
|
||||
const ka = /[\x00-\x7F]+/g;
|
||||
const la = /[\x00-\x7F]+/g;
|
||||
var ma = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:K, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:L}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:L, replacer:ha, matcher:M}, LatinExtra:{normalize:!0, dedupe:!0, mapper:L, replacer:ha.concat([/(?!^)[aeoy]/g, ""]), matcher:M}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
|
||||
var la = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:K, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:L}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:L, replacer:N, matcher:M}, LatinExtra:{normalize:!0, dedupe:!0, mapper:L, replacer:N.concat([/(?!^)[aeoy]/g, ""]), matcher:M}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
|
||||
for (let b = 0; b < a.length; b++) {
|
||||
var c = a[b];
|
||||
let d = c.charAt(0), f = ia[d];
|
||||
for (let e = 1, g; e < c.length && (g = c.charAt(e), "h" === g || "w" === g || !(g = ia[g]) || g === f || (d += g, f = g, 4 !== d.length)); e++) {
|
||||
let d = c.charAt(0), f = ha[d];
|
||||
for (let e = 1, g; e < c.length && (g = c.charAt(e), "h" === g || "w" === g || !(g = ha[g]) || g === f || (d += g, f = g, 4 !== d.length)); e++) {
|
||||
}
|
||||
a[b] = d;
|
||||
}
|
||||
}}, ArabicDefault:{rtl:!0, normalize:!1, dedupe:!0, prepare:function(a) {
|
||||
return ("" + a).replace(ja, " ");
|
||||
return ("" + a).replace(ia, " ");
|
||||
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
|
||||
return ("" + a).replace(ka, "");
|
||||
return ("" + a).replace(ja, "");
|
||||
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
|
||||
return ("" + a).replace(la, " ");
|
||||
return ("" + a).replace(ka, " ");
|
||||
}}};
|
||||
function na(a, c, b, d, f, e, g, h) {
|
||||
function ma(a, c, b, d, f, e, g, h) {
|
||||
(d = a(b ? b + "." + d : d, JSON.stringify(g))) && d.then ? d.then(function() {
|
||||
c.export(a, c, b, f, e + 1, h);
|
||||
}) : c.export(a, c, b, f, e + 1, h);
|
||||
}
|
||||
;const oa = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
|
||||
function pa(a) {
|
||||
N.call(a, "add");
|
||||
N.call(a, "append");
|
||||
N.call(a, "search");
|
||||
N.call(a, "update");
|
||||
N.call(a, "remove");
|
||||
;const na = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
|
||||
function oa(a) {
|
||||
O.call(a, "add");
|
||||
O.call(a, "append");
|
||||
O.call(a, "search");
|
||||
O.call(a, "update");
|
||||
O.call(a, "remove");
|
||||
}
|
||||
function N(a) {
|
||||
function O(a) {
|
||||
this[a + "Async"] = function() {
|
||||
var c = arguments;
|
||||
const b = c[c.length - 1];
|
||||
@@ -229,27 +229,27 @@ function N(a) {
|
||||
};
|
||||
}
|
||||
;y();
|
||||
O.prototype.add = function(a, c, b, d) {
|
||||
P.prototype.add = function(a, c, b, d) {
|
||||
if (c && (a || 0 === a)) {
|
||||
if (!d && !b && this.reg.has(a)) {
|
||||
return this.update(a, c);
|
||||
}
|
||||
c = this.encoder.encode(c);
|
||||
if (d = c.length) {
|
||||
const m = y(), l = y(), r = this.depth, t = this.resolution;
|
||||
const l = y(), n = y(), r = this.depth, t = this.resolution;
|
||||
for (let p = 0; p < d; p++) {
|
||||
let n = c[this.rtl ? d - 1 - p : p];
|
||||
var f = n.length;
|
||||
if (f && (r || !l[n])) {
|
||||
var e = this.score ? this.score(c, n, p, null, 0) : P(t, d, p), g = "";
|
||||
let m = c[this.rtl ? d - 1 - p : p];
|
||||
var f = m.length;
|
||||
if (f && (r || !n[m])) {
|
||||
var e = this.score ? this.score(c, m, p, null, 0) : Q(t, d, p), g = "";
|
||||
switch(this.tokenize) {
|
||||
case "full":
|
||||
if (2 < f) {
|
||||
for (e = 0; e < f; e++) {
|
||||
for (var h = f; h > e; h--) {
|
||||
g = n.substring(e, h);
|
||||
var k = this.score ? this.score(c, n, p, g, e) : P(t, d, p, f, e);
|
||||
Q(this, l, g, k, a, b);
|
||||
g = m.substring(e, h);
|
||||
var k = this.score ? this.score(c, m, p, g, e) : Q(t, d, p, f, e);
|
||||
R(this, n, g, k, a, b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -257,24 +257,24 @@ O.prototype.add = function(a, c, b, d) {
|
||||
case "reverse":
|
||||
if (1 < f) {
|
||||
for (h = f - 1; 0 < h; h--) {
|
||||
g = n[h] + g, k = this.score ? this.score(c, n, p, g, h) : P(t, d, p, f, h), Q(this, l, g, k, a, b);
|
||||
g = m[h] + g, k = this.score ? this.score(c, m, p, g, h) : Q(t, d, p, f, h), R(this, n, g, k, a, b);
|
||||
}
|
||||
g = "";
|
||||
}
|
||||
case "forward":
|
||||
if (1 < f) {
|
||||
for (h = 0; h < f; h++) {
|
||||
g += n[h], Q(this, l, g, e, a, b);
|
||||
g += m[h], R(this, n, g, e, a, b);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (Q(this, l, n, e, a, b), r && 1 < d && p < d - 1) {
|
||||
for (f = y(), g = this.I, e = n, h = Math.min(r + 1, d - p), f[e] = 1, k = 1; k < h; k++) {
|
||||
if ((n = c[this.rtl ? d - 1 - p - k : p + k]) && !f[n]) {
|
||||
f[n] = 1;
|
||||
const w = this.score ? this.score(c, e, p, n, k) : P(g + (d / 2 > g ? 0 : 1), d, p, h - 1, k - 1), B = this.bidirectional && n > e;
|
||||
Q(this, m, B ? e : n, w, a, b, B ? n : e);
|
||||
if (R(this, n, m, e, a, b), r && 1 < d && p < d - 1) {
|
||||
for (f = y(), g = this.I, e = m, h = Math.min(r + 1, d - p), f[e] = 1, k = 1; k < h; k++) {
|
||||
if ((m = c[this.rtl ? d - 1 - p - k : p + k]) && !f[m]) {
|
||||
f[m] = 1;
|
||||
const w = this.score ? this.score(c, e, p, m, k) : Q(g + (d / 2 > g ? 0 : 1), d, p, h - 1, k - 1), B = this.bidirectional && m > e;
|
||||
R(this, l, B ? e : m, w, a, b, B ? m : e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,14 +286,14 @@ O.prototype.add = function(a, c, b, d) {
|
||||
}
|
||||
return this;
|
||||
};
|
||||
function Q(a, c, b, d, f, e, g) {
|
||||
function R(a, c, b, d, f, e, g) {
|
||||
let h = g ? a.ctx : a.map, k;
|
||||
c[b] && g && (k = c[b])[g] || (g ? (c = k || (c[b] = y()), c[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[d] || (h[d] = []), e && h.includes(f) || (h.push(f), a.fastupdate && ((c = a.reg.get(f)) ? c.push(h) : a.reg.set(f, [h]))));
|
||||
}
|
||||
function P(a, c, b, d, f) {
|
||||
function Q(a, c, b, d, f) {
|
||||
return b && 1 < a ? c + (d || 0) <= a ? b + (f || 0) : (a - 1) / (c + (d || 0)) * (b + (f || 0)) + 1 | 0 : 0;
|
||||
}
|
||||
;function R(a, c, b) {
|
||||
;function pa(a, c, b) {
|
||||
if (1 === a.length) {
|
||||
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ function P(a, c, b, d, f) {
|
||||
}
|
||||
return d;
|
||||
}
|
||||
;O.prototype.search = function(a, c, b) {
|
||||
;P.prototype.search = function(a, c, b) {
|
||||
b || (!c && E(a) ? (b = a, a = "") : E(c) && (b = c, c = 0));
|
||||
var d = [], f = 0;
|
||||
if (b) {
|
||||
@@ -358,18 +358,18 @@ function P(a, c, b, d, f) {
|
||||
}
|
||||
var h = 0, k = 0;
|
||||
if (1 < b) {
|
||||
var m = y();
|
||||
var l = y();
|
||||
const r = [];
|
||||
for (let t = 0, p; t < b; t++) {
|
||||
if ((p = a[t]) && !m[p]) {
|
||||
if ((p = a[t]) && !l[p]) {
|
||||
if (g || T(this, p)) {
|
||||
r.push(p), m[p] = 1;
|
||||
r.push(p), l[p] = 1;
|
||||
} else {
|
||||
return d;
|
||||
}
|
||||
const n = p.length;
|
||||
h = Math.max(h, n);
|
||||
k = k ? Math.min(k, n) : n;
|
||||
const m = p.length;
|
||||
h = Math.max(h, m);
|
||||
k = k ? Math.min(k, m) : m;
|
||||
}
|
||||
}
|
||||
a = r;
|
||||
@@ -378,7 +378,7 @@ function P(a, c, b, d, f) {
|
||||
if (!b) {
|
||||
return d;
|
||||
}
|
||||
m = 0;
|
||||
l = 0;
|
||||
if (1 === b) {
|
||||
return S.call(this, a[0], "", c, f);
|
||||
}
|
||||
@@ -387,44 +387,44 @@ function P(a, c, b, d, f) {
|
||||
}
|
||||
if (1 < b) {
|
||||
if (e) {
|
||||
var l = a[0];
|
||||
m = 1;
|
||||
var n = a[0];
|
||||
l = 1;
|
||||
} else {
|
||||
9 < h && 3 < h / k && a.sort(aa);
|
||||
}
|
||||
}
|
||||
for (let r, t; m < b; m++) {
|
||||
t = a[m];
|
||||
l ? (r = T(this, t, l), r = ra(r, d, g, this.I, c, f, 2 === b), g && !1 === r && d.length || (l = t)) : (r = T(this, t), r = ra(r, d, g, this.resolution, c, f, 1 === b));
|
||||
for (let r, t; l < b; l++) {
|
||||
t = a[l];
|
||||
n ? (r = T(this, t, n), r = ra(r, d, g, this.I), g && !1 === r && d.length || (n = t)) : (r = T(this, t, ""), r = ra(r, d, g, this.resolution));
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
if (g && m === b - 1) {
|
||||
if (g && l === b - 1) {
|
||||
e = d.length;
|
||||
if (!e) {
|
||||
if (l) {
|
||||
l = "";
|
||||
m = -1;
|
||||
if (n) {
|
||||
n = "";
|
||||
l = -1;
|
||||
continue;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
if (1 === e) {
|
||||
return R(d[0], c, f);
|
||||
return pa(d[0], c, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
a: {
|
||||
a = d;
|
||||
d = this.resolution;
|
||||
l = a.length;
|
||||
n = a.length;
|
||||
b = [];
|
||||
e = y();
|
||||
for (let r = 0, t, p, n, w; r < d; r++) {
|
||||
for (k = 0; k < l; k++) {
|
||||
if (n = a[k], r < n.length && (t = n[r])) {
|
||||
for (m = 0; m < t.length; m++) {
|
||||
p = t[m], (h = e[p]) ? e[p]++ : (h = 0, e[p] = 1), w = b[h] || (b[h] = []), w.push(p);
|
||||
for (let r = 0, t, p, m, w; r < d; r++) {
|
||||
for (k = 0; k < n; k++) {
|
||||
if (m = a[k], r < m.length && (t = m[r])) {
|
||||
for (l = 0; l < t.length; l++) {
|
||||
p = t[l], (h = e[p]) ? e[p]++ : (h = 0, e[p] = 1), w = b[h] || (b[h] = []), w.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,8 +437,8 @@ function P(a, c, b, d, f) {
|
||||
d = y();
|
||||
e = g.length;
|
||||
for (k = 0; k < e; k++) {
|
||||
for (l = g[k], h = l.length, m = 0; m < h; m++) {
|
||||
if (b = l[m], !d[b]) {
|
||||
for (n = g[k], h = n.length, l = 0; l < h; l++) {
|
||||
if (b = n[l], !d[b]) {
|
||||
if (d[b] = 1, f) {
|
||||
f--;
|
||||
} else {
|
||||
@@ -455,7 +455,7 @@ function P(a, c, b, d, f) {
|
||||
}
|
||||
b = c;
|
||||
} else {
|
||||
if (a < l) {
|
||||
if (a < n) {
|
||||
d = [];
|
||||
break a;
|
||||
}
|
||||
@@ -470,28 +470,21 @@ function P(a, c, b, d, f) {
|
||||
return d;
|
||||
};
|
||||
function S(a, c, b, d) {
|
||||
return (a = T(this, a, c)) && a.length ? R(a, b, d) : [];
|
||||
return (a = T(this, a, c)) && a.length ? pa(a, b, d) : [];
|
||||
}
|
||||
function ra(a, c, b, d, f, e, g) {
|
||||
let h = [];
|
||||
function ra(a, c, b, d) {
|
||||
let f = [];
|
||||
if (a) {
|
||||
d = Math.min(a.length, d);
|
||||
for (let k = 0, m = 0, l; k < d; k++) {
|
||||
if (l = a[k]) {
|
||||
if (e && l && g && (l.length <= e ? (e -= l.length, l = null) : (l = l.slice(e), e = 0)), l && (h[k] = l, g && (m += l.length, m >= f))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (let e = 0, g; e < d; e++) {
|
||||
(g = a[e]) && g && (f[e] = g);
|
||||
}
|
||||
if (h.length) {
|
||||
if (g) {
|
||||
return R(h, f, 0);
|
||||
}
|
||||
c.push(h);
|
||||
if (f.length) {
|
||||
c.push(f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return !b && h;
|
||||
return !b && f;
|
||||
}
|
||||
function T(a, c, b) {
|
||||
let d;
|
||||
@@ -499,7 +492,7 @@ function T(a, c, b) {
|
||||
a = b ? (a = a.ctx.get(d ? c : b)) && a.get(d ? b : c) : a.map.get(c);
|
||||
return a;
|
||||
}
|
||||
;O.prototype.remove = function(a, c) {
|
||||
;P.prototype.remove = function(a, c) {
|
||||
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
|
||||
if (b) {
|
||||
if (this.fastupdate) {
|
||||
@@ -541,18 +534,18 @@ function U(a, c) {
|
||||
}
|
||||
return b;
|
||||
}
|
||||
;function O(a, c) {
|
||||
;function P(a, c) {
|
||||
if (!this) {
|
||||
return new O(a);
|
||||
return new P(a);
|
||||
}
|
||||
if (a) {
|
||||
var b = z(a) ? a : a.preset;
|
||||
b && (oa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, oa[b], a));
|
||||
b && (na[b] || console.warn("Preset not found: " + b), a = Object.assign({}, na[b], a));
|
||||
} else {
|
||||
a = {};
|
||||
}
|
||||
b = a.context || {};
|
||||
const d = a.encode || a.encoder || K;
|
||||
const d = z(a.encoder) ? la[a.encoder] : a.encode || a.encoder || K;
|
||||
this.encoder = d.encode ? d : "object" === typeof d ? new J(d) : {encode:d};
|
||||
let f;
|
||||
this.resolution = a.resolution || 9;
|
||||
@@ -567,7 +560,7 @@ function U(a, c) {
|
||||
this.I = b.resolution || 1;
|
||||
this.rtl = d.rtl || a.rtl || !1;
|
||||
}
|
||||
u = O.prototype;
|
||||
u = P.prototype;
|
||||
u.clear = function() {
|
||||
this.map.clear();
|
||||
this.ctx.clear();
|
||||
@@ -608,8 +601,8 @@ u.cleanup = function() {
|
||||
};
|
||||
u.export = function(a, c, b, d, f, e) {
|
||||
let g = !0;
|
||||
"undefined" === typeof e && (g = new Promise(m => {
|
||||
e = m;
|
||||
"undefined" === typeof e && (g = new Promise(l => {
|
||||
e = l;
|
||||
}));
|
||||
let h, k;
|
||||
switch(f || (f = 0)) {
|
||||
@@ -617,8 +610,8 @@ u.export = function(a, c, b, d, f, e) {
|
||||
h = "reg";
|
||||
if (this.fastupdate) {
|
||||
k = y();
|
||||
for (let m of this.reg.keys()) {
|
||||
k[m] = 1;
|
||||
for (let l of this.reg.keys()) {
|
||||
k[l] = 1;
|
||||
}
|
||||
} else {
|
||||
k = this.reg;
|
||||
@@ -640,7 +633,7 @@ u.export = function(a, c, b, d, f, e) {
|
||||
"undefined" === typeof b && e && e();
|
||||
return;
|
||||
}
|
||||
na(a, c || this, b, h, d, f, k, e);
|
||||
ma(a, c || this, b, h, d, f, k, e);
|
||||
return g;
|
||||
};
|
||||
u.import = function(a, c) {
|
||||
@@ -673,11 +666,11 @@ u.serialize = function(a = !0) {
|
||||
d = "";
|
||||
for (var f of this.map.entries()) {
|
||||
var e = f[0], g = f[1], h = "";
|
||||
for (let l = 0, r; l < g.length; l++) {
|
||||
r = g[l] || [""];
|
||||
for (let n = 0, r; n < g.length; n++) {
|
||||
r = g[n] || [""];
|
||||
var k = "";
|
||||
for (var m = 0; m < r.length; m++) {
|
||||
k += (k ? "," : "") + ("string" === b ? '"' + r[m] + '"' : r[m]);
|
||||
for (var l = 0; l < r.length; l++) {
|
||||
k += (k ? "," : "") + ("string" === b ? '"' + r[l] + '"' : r[l]);
|
||||
}
|
||||
k = "[" + k + "]";
|
||||
h += (h ? "," : "") + k;
|
||||
@@ -687,21 +680,21 @@ u.serialize = function(a = !0) {
|
||||
}
|
||||
d = "index.map=new Map([" + d + "]);";
|
||||
f = "";
|
||||
for (const l of this.ctx.entries()) {
|
||||
e = l[0];
|
||||
g = l[1];
|
||||
for (const n of this.ctx.entries()) {
|
||||
e = n[0];
|
||||
g = n[1];
|
||||
for (const r of g.entries()) {
|
||||
g = r[0];
|
||||
h = r[1];
|
||||
k = "";
|
||||
for (let t = 0, p; t < h.length; t++) {
|
||||
p = h[t] || [""];
|
||||
m = "";
|
||||
for (let n = 0; n < p.length; n++) {
|
||||
m += (m ? "," : "") + ("string" === b ? '"' + p[n] + '"' : p[n]);
|
||||
l = "";
|
||||
for (let m = 0; m < p.length; m++) {
|
||||
l += (l ? "," : "") + ("string" === b ? '"' + p[m] + '"' : p[m]);
|
||||
}
|
||||
m = "[" + m + "]";
|
||||
k += (k ? "," : "") + m;
|
||||
l = "[" + l + "]";
|
||||
k += (k ? "," : "") + l;
|
||||
}
|
||||
k = 'new Map([["' + g + '",[' + k + "]]])";
|
||||
k = '["' + e + '",' + k + "]";
|
||||
@@ -711,7 +704,7 @@ u.serialize = function(a = !0) {
|
||||
f = "index.ctx=new Map([" + f + "]);";
|
||||
return a ? "function inject(index){" + c + d + f + "}" : c + d + f;
|
||||
};
|
||||
pa(O.prototype);
|
||||
oa(P.prototype);
|
||||
W.prototype.add = function(a, c, b) {
|
||||
E(a) && (c = a, a = F(c, this.key));
|
||||
if (c && (a || 0 === a)) {
|
||||
@@ -800,25 +793,25 @@ function X(a, c, b, d, f, e, g, h) {
|
||||
b || (!c && E(a) ? (b = a, a = "") : E(c) && (b = c, c = 0));
|
||||
let f = [];
|
||||
var e = [];
|
||||
let g, h, k, m, l;
|
||||
let g, h, k, l, n;
|
||||
let r = 0;
|
||||
if (b) {
|
||||
b.constructor === Array && (b = {index:b});
|
||||
a = b.query || a;
|
||||
var t = b.pluck;
|
||||
h = b.merge;
|
||||
m = t || b.field || b.index;
|
||||
l = !1;
|
||||
l = t || b.field || b.index;
|
||||
n = !1;
|
||||
g = this.store && b.enrich;
|
||||
k = b.suggest;
|
||||
c = b.limit || c;
|
||||
var p = b.offset || 0;
|
||||
c || (c = 100);
|
||||
if (l) {
|
||||
l.constructor !== Array && (l = [l]);
|
||||
var n = [];
|
||||
for (let v = 0, q; v < l.length; v++) {
|
||||
q = l[v];
|
||||
if (n) {
|
||||
n.constructor !== Array && (n = [n]);
|
||||
var m = [];
|
||||
for (let v = 0, q; v < n.length; v++) {
|
||||
q = n[v];
|
||||
if (z(q)) {
|
||||
throw Error("A tag option can't be a string, instead it needs a { field: tag } format.");
|
||||
}
|
||||
@@ -826,33 +819,33 @@ function X(a, c, b, d, f, e, g, h) {
|
||||
var w = q.tag;
|
||||
if (w.constructor === Array) {
|
||||
for (var B = 0; B < w.length; B++) {
|
||||
n.push(q.field, w[B]);
|
||||
m.push(q.field, w[B]);
|
||||
}
|
||||
} else {
|
||||
n.push(q.field, w);
|
||||
m.push(q.field, w);
|
||||
}
|
||||
} else {
|
||||
w = Object.keys(q);
|
||||
for (let C = 0, D, A; C < w.length; C++) {
|
||||
if (D = w[C], A = q[D], A.constructor === Array) {
|
||||
for (B = 0; B < A.length; B++) {
|
||||
n.push(D, A[B]);
|
||||
m.push(D, A[B]);
|
||||
}
|
||||
} else {
|
||||
n.push(D, A);
|
||||
m.push(D, A);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!n.length) {
|
||||
if (!m.length) {
|
||||
throw Error("Your tag definition within the search options is probably wrong. No valid tags found.");
|
||||
}
|
||||
l = n;
|
||||
n = m;
|
||||
if (!a) {
|
||||
d = [];
|
||||
if (n.length) {
|
||||
for (e = 0; e < n.length; e += 2) {
|
||||
t = sa.call(this, n[e], n[e + 1], c, p, g), f.push({field:n[e], tag:n[e + 1], result:t});
|
||||
if (m.length) {
|
||||
for (e = 0; e < m.length; e += 2) {
|
||||
t = sa.call(this, m[e], m[e + 1], c, p, g), f.push({field:m[e], tag:m[e + 1], result:t});
|
||||
}
|
||||
}
|
||||
return d.length ? Promise.all(d).then(function(v) {
|
||||
@@ -863,46 +856,46 @@ function X(a, c, b, d, f, e, g, h) {
|
||||
}) : f;
|
||||
}
|
||||
}
|
||||
z(m) && (m = [m]);
|
||||
z(l) && (l = [l]);
|
||||
}
|
||||
m || (m = this.field);
|
||||
l || (l = this.field);
|
||||
p = !d && (this.worker || this.db) && [];
|
||||
for (let v = 0, q, C, D; v < m.length; v++) {
|
||||
C = m[v];
|
||||
for (let v = 0, q, C, D; v < l.length; v++) {
|
||||
C = l[v];
|
||||
let A;
|
||||
z(C) || (A = C, C = A.field, a = A.query || a, c = A.limit || c, k = A.suggest || k);
|
||||
if (d) {
|
||||
q = d[v];
|
||||
} else {
|
||||
if (n = A || b, w = this.index.get(C), l && (n.enrich = !1), p) {
|
||||
p[v] = w.searchAsync(a, c, n);
|
||||
n && g && (n.enrich = g);
|
||||
if (m = A || b, w = this.index.get(C), n && (m.enrich = !1), p) {
|
||||
p[v] = w.searchAsync(a, c, m);
|
||||
m && g && (m.enrich = g);
|
||||
continue;
|
||||
} else {
|
||||
q = w.search(a, c, n), n && g && (n.enrich = g);
|
||||
q = w.search(a, c, m), m && g && (m.enrich = g);
|
||||
}
|
||||
}
|
||||
D = q && q.length;
|
||||
if (l && D) {
|
||||
n = [];
|
||||
if (n && D) {
|
||||
m = [];
|
||||
w = 0;
|
||||
for (let G = 0, H, ua; G < l.length; G += 2) {
|
||||
H = this.tag.get(l[G]);
|
||||
for (let G = 0, H, ua; G < n.length; G += 2) {
|
||||
H = this.tag.get(n[G]);
|
||||
if (!H) {
|
||||
if (console.warn("Tag '" + l[G] + ":" + l[G + 1] + "' will be skipped because there is no field '" + l[G] + "'."), k) {
|
||||
if (console.warn("Tag '" + n[G] + ":" + n[G + 1] + "' will be skipped because there is no field '" + n[G] + "'."), k) {
|
||||
continue;
|
||||
} else {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
if (ua = (H = H && H.get(l[G + 1])) && H.length) {
|
||||
w++, n.push(H);
|
||||
if (ua = (H = H && H.get(n[G + 1])) && H.length) {
|
||||
w++, m.push(H);
|
||||
} else if (!k) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
if (w) {
|
||||
q = qa(q, n);
|
||||
q = qa(q, m);
|
||||
D = q.length;
|
||||
if (!D && !k) {
|
||||
return f;
|
||||
@@ -912,7 +905,7 @@ function X(a, c, b, d, f, e, g, h) {
|
||||
}
|
||||
if (D) {
|
||||
e[r] = C, f.push(q), r++;
|
||||
} else if (1 === m.length) {
|
||||
} else if (1 === l.length) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
@@ -944,15 +937,15 @@ function va(a, c) {
|
||||
for (let f = 0, e, g; f < a.length; f++) {
|
||||
e = a[f];
|
||||
g = e.result;
|
||||
for (let h = 0, k, m, l; h < g.length; h++) {
|
||||
if (m = g[h], k = m.id, l = d[k]) {
|
||||
l.push(e.field);
|
||||
for (let h = 0, k, l, n; h < g.length; h++) {
|
||||
if (l = g[h], k = l.id, n = d[k]) {
|
||||
n.push(e.field);
|
||||
} else {
|
||||
if (b.length === c) {
|
||||
return b;
|
||||
}
|
||||
m.field = d[k] = [e.field];
|
||||
b.push(m);
|
||||
l.field = d[k] = [e.field];
|
||||
b.push(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -995,7 +988,7 @@ function ta(a) {
|
||||
let d = c.index || c.field || c;
|
||||
z(d) && (d = [d]);
|
||||
for (let f = 0, e, g; f < d.length; f++) {
|
||||
e = d[f], z(e) || (g = e, e = e.field), g = E(g) ? Object.assign({}, a, g) : a, b.set(e, new O(g, this.reg)), g.custom ? this.A[f] = g.custom : (this.A[f] = Z(e, this.D), g.filter && ("string" === typeof this.A[f] && (this.A[f] = new String(this.A[f])), this.A[f].H = g.filter)), this.field[f] = e;
|
||||
e = d[f], z(e) || (g = e, e = e.field), g = E(g) ? Object.assign({}, a, g) : a, b.set(e, new P(g, this.reg)), g.custom ? this.A[f] = g.custom : (this.A[f] = Z(e, this.D), g.filter && ("string" === typeof this.A[f] && (this.A[f] = new String(this.A[f])), this.A[f].H = g.filter)), this.field[f] = e;
|
||||
}
|
||||
if (this.h) {
|
||||
a = c.store;
|
||||
@@ -1081,7 +1074,7 @@ u.export = function(a, c, b, d, f, e) {
|
||||
e();
|
||||
return;
|
||||
}
|
||||
na(a, this, b, c, d, f, h, e);
|
||||
ma(a, this, b, c, d, f, h, e);
|
||||
}
|
||||
return g;
|
||||
};
|
||||
@@ -1109,7 +1102,7 @@ u.import = function(a, c) {
|
||||
}
|
||||
}
|
||||
};
|
||||
pa(W.prototype);
|
||||
export default {Index:O, Charset:ma, Encoder:J, Document:W, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
|
||||
oa(W.prototype);
|
||||
export default {Index:P, Charset:la, Encoder:J, Document:W, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
|
||||
|
||||
export const Index=O;export const Charset=ma;export const Encoder=J;export const Document=W;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
|
||||
export const Index=P;export const Charset=la;export const Encoder=J;export const Document=W;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
|
Reference in New Issue
Block a user