From 316f5a466f6fece90b5bba29be6d66f98dd4c965 Mon Sep 17 00:00:00 2001 From: Thomas Wilkerling Date: Mon, 14 Jun 2021 12:50:58 +0200 Subject: [PATCH] fix #223 #224 --- README.md | 32 +++++++++++++++---------------- dist/flexsearch.bundle.js | 8 ++++---- dist/flexsearch.compact.js | 10 +++++----- dist/flexsearch.debug.js | 11 ++++++----- dist/flexsearch.es5.js | 14 +++++++------- dist/flexsearch.light.js | 8 ++++---- dist/module/document.js | 2 +- dist/module/index.js | 2 +- dist/module/lang/latin/default.js | 2 +- dist/module/lang/latin/simple.js | 2 +- package.json | 2 +- src/document.js | 19 ++++++++++-------- src/index.js | 15 +++++++++------ src/lang/latin/balance.js | 2 +- src/lang/latin/default.js | 2 +- src/lang/latin/simple.js | 2 ++ 16 files changed, 71 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index b6abaa1..6942a11 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,17 @@ Basic Start  •  API Reference  •  Document Indexes  •  Using Worker  •  Changelog -### FlexSearch v0.7.0 +### FlexSearch v0.7.1 -The new version is finally available. FlexSearch v0.7.0 is a modern re-implementation and was newly developed from the ground up. The result is an improvement in every single aspect and covers tons of enhancements and improvements which was collected over the last 3 years. +The new version is finally available. FlexSearch v0.7.1 is a modern re-implementation and was newly developed from the ground up. The result is an improvement in every single aspect and covers tons of enhancements and improvements which was collected over the last 3 years. This new version has a good compatibility with the old generation, but it might require some migrations steps in your code. Read the documentation of new features and changes:
-https://github.com/nextapps-de/flexsearch/blob/0.7.0/doc/0.7.0.md +https://github.com/nextapps-de/flexsearch/blob/master/doc/0.7.0.md Read the documentation of new language encoding features:
-https://github.com/nextapps-de/flexsearch/blob/0.7.0/doc/0.7.0-lang.md +https://github.com/nextapps-de/flexsearch/blob/master/doc/0.7.0-lang.md

@@ -65,31 +65,31 @@ __Get Latest Stable Build (Recommended):__ flexsearch.bundle.js - Download - https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.0/dist/flexsearch.bundle.js + Download + https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.1/dist/flexsearch.bundle.js flexsearch.light.js - Download - https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.0/dist/flexsearch.light.js + Download + https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.1/dist/flexsearch.light.js flexsearch.compact.js - Download - https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.0/dist/flexsearch.compact.js + Download + https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.1/dist/flexsearch.compact.js flexsearch.es5.js * - Download - https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.0/dist/flexsearch.es5.js + Download + https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.1/dist/flexsearch.es5.js ES6 Modules - Download + Download The /dist/module/ folder of this Github repository @@ -104,7 +104,7 @@ npm install flexsearch __Get Latest Nightly (Do not use for production!):__ -Just exchange the version number from the URLs above with "master", e.g.: "/flexsearch/__0.7.0__/dist/" into "/flexsearch/__master__/dist". +Just exchange the version number from the URLs above with "master", e.g.: "/flexsearch/__0.7.1__/dist/" into "/flexsearch/__master__/dist". __Compare Web-Bundles:__ @@ -428,7 +428,7 @@ const worker = new WorkerIndex(options); Or via CDN: ```html - + ``` AMD: @@ -2121,7 +2121,7 @@ A common scenario for using a cache is an autocomplete or instant search when ty ## Worker Parallelism (Browser + Node.js) -The new worker model from v0.7.0 is divided into "fields" from the document (1 worker = 1 field index). This way the worker becomes able to solve tasks (subtasks) completely. The downside of this paradigm is they might not have been perfect balanced in storing contents (fields may have different length of contents). On the other hand there is no indication that balancing the storage gives any advantage (they all require the same amount in total). +The new worker model from v0.7.1 is divided into "fields" from the document (1 worker = 1 field index). This way the worker becomes able to solve tasks (subtasks) completely. The downside of this paradigm is they might not have been perfect balanced in storing contents (fields may have different length of contents). On the other hand there is no indication that balancing the storage gives any advantage (they all require the same amount in total). When using a document index, then just apply the option "worker": ```js diff --git a/dist/flexsearch.bundle.js b/dist/flexsearch.bundle.js index a0b3a1d..44363fc 100644 --- a/dist/flexsearch.bundle.js +++ b/dist/flexsearch.bundle.js @@ -1,19 +1,19 @@ /**! - * FlexSearch.js v0.7.0 (Bundle) + * FlexSearch.js v0.7.1 (Bundle) * Copyright 2018-2021 Nextapps GmbH * Author: Thomas Wilkerling * Licence: Apache-2.0 * https://github.com/nextapps-de/flexsearch */ (function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var t;function u(a){return"undefined"!==typeof a?a:!0}function aa(a){const b=Array(a);for(let c=0;c=this.B&&(w||!n[l])){var f=L(q,d,r),g="";switch(this.F){case "full":if(3f;h--)if(h-f>=this.B){var k=L(q,d,r,e,f);g=l.substring(f,h);M(this,n,g,k,a,c)}break}case "reverse":if(2=this.B&&M(this,n, g,L(q,d,r,e,h),a,c);g=""}case "forward":if(1=this.B&&M(this,n,g,f,a,c);break}default:if(M(this,n,l,f,a,c),w&&1=this.B&&!e[l]){e[l]=1;const p=this.l&&l>f;M(this,m,p?f:l,L(g+(d/2>g?0:1),d,r,h-1,k-1),a,c,p?l:f)}}}}this.m||(this.register[a]=1)}}return this};function L(a,b,c,d,e){return c&&1=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);h=this.depth&&1=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);h=this.depth&&1=d)))break;if(n){if(f)return ua(k,d,0);b[b.length]=k;return}}return!c&&k}function ua(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function va(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; @@ -27,7 +27,7 @@ function U(a,b,c,d,e){a=a[e];if(d===c.length-1)b[e]=a;else if(a)if(a.constructor t.add=function(a,b,c){C(a)&&(b=a,a=T(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(let d=0,e,f;db||c)e=e.slice(c,c+b);d&&(e=Aa.call(this,e));return{tag:a,result:e}}}function Aa(a){const b=Array(a.length);for(let c=0,d;c=this.m&&(u||!n[l])){var f=P(q,e,r),g="";switch(this.C){case "full":if(3f;h--)if(h-f>=this.m){var k=P(q,e,r,d,f);g=l.substring(f,h);Q(this,n,g,k,a,c)}break}case "reverse":if(2=this.m&&Q(this,n, g,P(q,e,r,d,h),a,c);g=""}case "forward":if(1=this.m&&Q(this,n,g,f,a,c);break}default:if(Q(this,n,l,f,a,c),u&&1=this.m&&!d[l]){d[l]=1;const p=this.l&&l>f;Q(this,m,p?f:l,P(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this};function P(a,b,c,e,d){return c&&1=this.m&&!c[q])if(this.s||f||this.h[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1=this.m&&!c[q])if(this.s||f||this.h[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1=e)))break;if(n){if(f)return na(k,e,0);b[b.length]=k;return}}return!c&&k}function na(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function oa(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;eb||c)d=d.slice(c,c+b);e&&(d=ra.call(this,d));return{tag:a,result:d}}}function ra(a){const b=Array(a.length);for(let c=0,e;c=this.C&&(e||!g[l])){var n=P(h,d,k),m="";switch(this.H){case "full":if(3n;q--)if(q-n>=this.C){var r=P(h,d,k,p,n);m=l.substring(n,q);Q(this,g,m,r,a,c)}break}case "reverse":if(2=this.C&&Q(this,g,m,P(h,d,k, p,q),a,c);m=""}case "forward":if(1=this.C&&Q(this,g,m,n,a,c);break}default:if(Q(this,g,l,n,a,c),e&&1=this.C&&!p[l]){p[l]=1;var u=this.l&&l>n;Q(this,f,u?n:l,P(m+(d/2>m?0:1),d,k,q-1,r-1),a,c,u?l:n)}}}}this.o||(this.register[a]=1)}}return this};function P(a,b,c,d,f){return c&&1=this.C&&!c[n])if(this.B||e||this.map[n])k[p++]=n,c[n]=1;else return d;a=k;h=a.length}}if(!h)return d;b||(b=100);g=this.depth&&1=this.C&&!c[n])if(this.B||e||this.map[n])k[p++]=n,c[n]=1;else return d;a=k;h=a.length}}if(!h)return d;b||(b=100);g=this.depth&&1=d)))break;if(p){if(g)return za(k,d,0);b[b.length]=k;return}}return!c&&k}function za(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function Aa(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; t.remove=function(a,b){var c=this.register[a];if(c){if(this.o)for(var d=0,f;db||c)f=f.slice(c,c+b);d&&(f=Fa.call(this,f));return{tag:a,result:f}}}function Fa(a){for(var b=Array(a.length),c=0,d;cb||c)f=f.slice(c,c+b);d&&(f=Fa.call(this,f));return{tag:a,result:f}}}function Fa(a){for(var b=Array(a.length),c=0,d;c=this.h&&(r||!m[l])){var h=K(p,d,q),f="";switch(this.C){case "full":if(3h;g--)if(g-h>=this.h){var k=K(p,d,q,e,h);f=l.substring(h,g);L(this,m,f,k,a,b)}break}case "reverse":if(2=this.h&&L(this, m,f,K(p,d,q,e,g),a,b);f=""}case "forward":if(1=this.h&&L(this,m,f,h,a,b);break}default:if(L(this,m,l,h,a,b),r&&1=this.h&&!e[l]){e[l]=1;const u=this.l&&l>h;L(this,n,u?h:l,K(f+(d/2>f?0:1),d,q,g-1,k-1),a,b,u?l:h)}}}}this.s||(this.register[a]=1)}}return this};function K(a,c,b,d,e){return b&&1=this.h&&!b[p])if(this.g||h||this.i[p])k[r++]=p,b[p]=1;else return d;a=k;e=a.length}if(!e)return d;c||(c=100);g=this.j&&1=this.h&&!b[p])if(this.g||h||this.i[p])k[r++]=p,b[p]=1;else return d;a=k;e=a.length}if(!e)return d;c||(c=100);g=this.j&&1=d)))break;if(m){if(h)return P(k,d,0);c[c.length]=k;return}}return!b&&k}function P(a,c,b){a=1===a.length?a[0]:[].concat.apply([],a);return b||a.length>c?a.slice(b,b+c):a} function Q(a,c,b,d){b?(d=d&&c>b,a=(a=a[d?c:b])&&a[d?b:c]):a=a[c];return a}J.prototype.contain=function(a){return!!this.register[a]};J.prototype.update=function(a,c){return this.remove(a).add(a,c)};J.prototype.remove=function(a,c){const b=this.register[a];if(b){if(this.s)for(let d=0,e;db||c)&&(e=e.slice(c,c+b)),d&&(e=apply_enrich.call(this,e)),{tag:a,result:e}}function apply_enrich(a){const b=Array(a.length);for(let c,d=0;db||c)&&(e=e.slice(c,c+b)),d&&(e=apply_enrich.call(this,e)),{tag:a,result:e}}function apply_enrich(a){const b=Array(a.length);for(let c,d=0;d=this.minlength&&(g||!f[i])){const l=get_score(h,e,j);let m="";switch(this.tokenize){case"full":if(3b;d--)if(d-b>=this.minlength){const g=get_score(h,e,j,k,b);m=i.substring(b,d),this.push_index(f,m,g,a,c)}break}case"reverse":if(2=this.minlength){const d=get_score(h,e,j,k,b);this.push_index(f,m,d,a,c)}m=""}case"forward":if(1=this.minlength&&this.push_index(f,m,l,a,c);break}default:if(this.push_index(f,i,l,a,c),g&&1=this.minlength&&!f[i]){f[i]=1;const b=get_score(h+(e/2>h?0:1),e,j,l-1,g-1),m=this.bidirectional&&i>k;this.push_index(d,m?k:i,b,a,c,m?i:k)}}}}}this.fastupdate||(this.register[a]=1)}}return this};function get_score(a,b,c,d,e){return c&&1=this.minlength&&!b[e]){if(!this.optimize&&!f&&!this.map[e])return g;c[i++]=e,b[e]=1}a=c,d=a.length}if(!d)return g;b||(b=100);let i,j=this.depth&&1=c)))));l++);if(b)return e?single_result(h,c,0):void(a[a.length]=h)}return!b&&h};function single_result(a,b,c){return a=1===a.length?a[0]:concat(a),c||a.length>b?a.slice(c,c+b):a}function get_array(a,b,c,d){if(c){const e=d&&b>c;a=a[e?b:c],a=a&&a[e?c:b]}else a=a[b];return a}Index.prototype.contain=function(a){return!!this.register[a]},Index.prototype.update=function(a,b){return this.remove(a).add(a,b)},Index.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.fastupdate)for(let b,d=0;d=this.minlength&&(g||!f[i])){const l=get_score(h,e,j);let m="";switch(this.tokenize){case"full":if(3b;d--)if(d-b>=this.minlength){const g=get_score(h,e,j,k,b);m=i.substring(b,d),this.push_index(f,m,g,a,c)}break}case"reverse":if(2=this.minlength){const d=get_score(h,e,j,k,b);this.push_index(f,m,d,a,c)}m=""}case"forward":if(1=this.minlength&&this.push_index(f,m,l,a,c);break}default:if(this.push_index(f,i,l,a,c),g&&1=this.minlength&&!f[i]){f[i]=1;const b=get_score(h+(e/2>h?0:1),e,j,l-1,g-1),m=this.bidirectional&&i>k;this.push_index(d,m?k:i,b,a,c,m?i:k)}}}}}this.fastupdate||(this.register[a]=1)}}return this};function get_score(a,b,c,d,e){return c&&1=this.minlength&&!b[e]){if(!this.optimize&&!f&&!this.map[e])return g;c[i++]=e,b[e]=1}a=c,d=a.length}if(!d)return g;b||(b=100);let i,j=this.depth&&1=c)))));l++);if(b)return e?single_result(h,c,0):void(a[a.length]=h)}return!b&&h};function single_result(a,b,c){return a=1===a.length?a[0]:concat(a),c||a.length>b?a.slice(c,c+b):a}function get_array(a,b,c,d){if(c){const e=d&&b>c;a=a[e?b:c],a=a&&a[e?c:b]}else a=a[b];return a}Index.prototype.contain=function(a){return!!this.register[a]},Index.prototype.update=function(a,b){return this.remove(a).add(a,b)},Index.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.fastupdate)for(let b,d=0;d