Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flexsearch

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexsearch - npm Package Compare versions

Comparing version 0.2.481 to 0.3.0

85

compile.js
var child_process = require('child_process');
var fs = require('fs');

@@ -11,2 +12,7 @@ var supported_lang = [

fs.existsSync("log") || fs.mkdirSync("log");
var flag_str = "";
var language_out;
var options = (function(argv){

@@ -23,6 +29,15 @@

val = index[1];
index = index[0];
index = index[0].toUpperCase();
arr[index] = val;
if(index === "LANGUAGE_OUT"){
language_out = val;
}
else{
flag_str += " --define='" + index + "=" + val + "'";
arr[index] = val;
}
if(count > 3) console.log(index + ': ' + val);

@@ -50,26 +65,40 @@ }

//console.log(parameter);
return parameter;
})({
compilation_level: "ADVANCED_OPTIMIZATIONS",
compilation_level: "ADVANCED_OPTIMIZATIONS", //"WHITESPACE"
use_types_for_optimization: true,
new_type_inf: true,
jscomp_warning: "newCheckTypes",
//jscomp_error: "strictCheckTypes",
generate_exports: true,
export_local_property_definitions: true,
language_in: "ECMASCRIPT5_STRICT",
language_out: "ECMASCRIPT5_STRICT",
language_in: "ECMASCRIPT6_STRICT",
language_out: language_out || "ECMASCRIPT5_STRICT",
process_closure_primitives: true,
summary_detail_level: 3,
warning_level: "VERBOSE",
emit_use_strict: options['RELEASE'] !== 'lang',
emit_use_strict: options["RELEASE"] !== "lang",
output_manifest: "log/manifest.log",
output_module_dependencies: "log/module_dependencies.log",
property_renaming_report: "log/renaming_report.log"
//formatting: "PRETTY_PRINT"
});
if(options['RELEASE'] === 'lang'){
var release = options["RELEASE"];
if(release === "demo"){
options['RELEASE'] = "custom";
}
var custom = (!options["RELEASE"] || (options["RELEASE"] === "custom"));
if(custom){
options["RELEASE"] = "custom." + hashCode(parameter + flag_str);
}
if(release === "lang"){
for(var i = 0; i < supported_lang.length; i++){

@@ -79,3 +108,3 @@

exec("java -jar node_modules/google-closure-compiler/compiler.jar" + parameter + " --define='SUPPORT_LANG_" + supported_lang[i].toUpperCase() + "=true' --js='lang/" + supported_lang[i] + ".js' --js_output_file='lang/" + supported_lang[i] + ".min.js' && exit 0", function(){
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + " --js='lang/" + supported_lang[i] + ".js'" + flag_str + " --js_output_file='lang/" + supported_lang[i] + ".min.js' && exit 0", function(){

@@ -90,8 +119,40 @@ console.log("Build Complete: " + supported_lang[i] + ".min.js");

exec("java -jar node_modules/google-closure-compiler/compiler.jar" + parameter + " --define='SUPPORT_DEBUG=" + (options['SUPPORT_DEBUG'] || 'false') + "' --define='SUPPORT_WORKER=" + (options['SUPPORT_WORKER'] || 'false') + "' --define='SUPPORT_BUILTINS=" + (options['SUPPORT_BUILTINS'] || 'false') + "' --define='SUPPORT_CACHE=" + (options['SUPPORT_CACHE'] || 'false') + "' --define='SUPPORT_ASYNC=" + (options['SUPPORT_ASYNC'] || 'false') + "' --define='SUPPORT_LANG_EN=" + (options['SUPPORT_LANG_EN'] || 'false') + "' --define='SUPPORT_LANG_DE=" + (options['SUPPORT_LANG_DE'] || 'false') + "' --js='flexsearch.js' --js='lang/**.js' --js='!lang/**.min.js' --js_output_file='flexsearch." + (options['RELEASE'] || 'custom') + ".js' && exit 0", function(){
exec("java -jar node_modules/google-closure-compiler-java/compiler.jar" + parameter + "' --js='flexsearch.js' --js='lang/**.js' --js='!lang/**.min.js'" + flag_str + " --js_output_file='flexsearch." + (options["RELEASE"] || "custom") + ".js' && exit 0", function(){
console.log("Build Complete: flexsearch." + (options['RELEASE'] || 'custom') + ".js");
var filename = "flexsearch." + (options["RELEASE"] || "custom") + ".js";
console.log("Build Complete: " + filename);
if(release === "demo"){
//fs.existsSync("dist/") || fs.mkdirSync("dist/");
//fs.existsSync("dist/latest") || fs.mkdirSync("dist/latest");
fs.copyFileSync(filename, "docs/" + filename);
//fs.copyFileSync(filename, "dist/latest/" + filename);
fs.unlinkSync(filename);
}
});
}
function hashCode(str) {
var hash = 0, i, chr;
if(str.length === 0){
return hash;
}
for(i = 0; i < str.length; i++){
chr = str.charCodeAt(i);
hash = (hash << 5) - hash + chr;
}
hash = Math.abs(hash) >> 0;
return hash.toString(16).substring(0, 5);
}
function exec(prompt, callback){

@@ -98,0 +159,0 @@

52

flexsearch.min.js
/*
FlexSearch v0.2.48
Copyright 2018 Thomas Wilkerling
FlexSearch v0.3.0
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(v,C,f){var w;(w=f.define)&&w.amd?w([],function(){return C}):(w=f.modules)?w[v.toLowerCase()]=C:"undefined"!==typeof module?module.exports=C:f[v]=C})("FlexSearch",function N(v){function f(a){"string"===typeof a&&(a=G[a]);a||(a=x);this.id=a.id||O++;this.init(a);w(this,"index",function(){return this.b});w(this,"length",function(){return Object.keys(this.b).length})}function w(a,b,e){Object.defineProperty(a,b,{get:e})}function d(a){return new RegExp(a,"g")}function y(a,b,e){if("undefined"===
typeof e){for(e=0;e<b.length;e+=2)a=a.replace(b[e],b[e+1]);return a}return a.replace(b,e)}function z(a,b,e,c,k,t,g){if("undefined"===typeof b[e]){var h=k?(9-(g||6))*t+(g||6)*k:t;b[e]=h;h>=g&&(a=a[h+.5|0],a=a[e]||(a[e]=[]),a[a.length]=c)}return h||b[e]}function q(a,b){if(a)for(var e=Object.keys(a),c=0,k=e.length;c<k;c++){var t=e[c],g=a[t];if(g)for(var h=0,d=g.length;h<d;h++)if(g[h]===b){1===d?delete a[t]:g.splice(h,1);break}else"object"===typeof g[h]&&q(g[h],b)}}function H(a){var b=[];if(!a)return b;
for(var e=0,c=0,k=0,t="",g=a.length,h=0;h<g;h++){var d=a[h];"a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d?e++:c++;" "!==d&&(t+=d);if(" "===d||e>=(8<g?2:1)&&2<=c||2<=e&&c>=(8<g?2:1)||h===g-1)t&&(b[k]&&2<t.length&&k++,b[k]=b[k]?b[k]+t:t," "===d&&k++,t=""),c=e=0}return b}function E(a){for(var b="",e="",c="",k=0;k<a.length;k++){var d=a[k];if(d!==e)if(k&&"h"===d){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e)&&c||" "===e)b+=d}else b+=
d;c=k===a.length-1?"":a[k+1];e=d}return b}function P(a,b){var e={};if(a)for(var c=0;c<a.length;c++){var k=b?b.call(A,a[c]):a[c];e[k]=String.fromCharCode(65E3-a.length+c)}return e}function Q(a,b){var e=[];if(a){var c=0,k;for(k in a)if(a.hasOwnProperty(k)){var t=b?b.call(A,k):k;e[c++]=d("(?=.{"+(t.length+3)+",})"+t+"$");e[c++]=b?b.call(A,a[k]):a[k]}}return e}function R(a,b){a=a.length-b.length;return 0>a?1:0<a?-1:0}function S(a,b){a=a.length-b.length;return 0>a?-1:0<a?1:0}function T(a,b,e){var c=[],
k=[],d=a.length;if(1<d){a.sort(S);for(var g={},h=a[0],f=h.length,m=0;m<f;)g[h[m++]]=1;for(var p,u=0,n=1;n<d;){var l=!1,q=n===d-1;k=[];h=a[n];f=h.length;for(m=-1;m<f;){var r=g[p=h[++m]];if(r===n){if(q&&(c[u++]=p,b&&u===b))return c;l=!0;g[p]=n+1}else e&&(r=k[r]||(k[r]=[]),r[r.length]=p)}if(!l&&!e)break;n++}if(e&&(b||(b=1E3),u=c.length,f=k.length,u<b&&f))for(n=f-1;0<=n;n--)if(p=k[n])for(m=0;m<p.length;m++)if(c[u++]=p[m],b&&u===b)return c}else d&&(c=a[0],b&&c.length>b&&(c=c.slice(0,b)));return c}function F(a){a.D||
(a.D=I(function(){a.D=null;var b=a.async;b&&(a.async=!1);if(a.f.length){for(var e=J(),c;(c=a.f.shift())||0===c;){var d=a.h[c];switch(d[0]){case D.add:a.add(d[1],d[2]);break;case D.remove:a.remove(d[1])}a.h[c]=null;delete a.h[c];if(100<J()-e)break}a.f.length&&F(a)}b&&(a.async=b)},1,"search-async-"+a.id))}function J(){return"undefined"!==typeof performance?performance.now():(new Date).getTime()}function U(a,b,e,c){a=v("flexsearch","id"+a,function(){var a,b;self.b=function(c){if(c=c.data)if(c.search){var e=
b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold}:c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:e})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.reset?b.reset():c.info?(c=b.info(),c.worker=a,b.F&&console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!0,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}},function(a){(a=
a.data)&&a.result?c(a.id,a.content,a.result,a.limit):e.debug&&console.log(a)},b);var d=N.toString();e.id=b;a.postMessage(b,{register:d,options:e,id:b});return a}var x={encode:"icase",mode:"ngram",w:!1,cache:!1,async:!1,c:!1,threshold:0,depth:0},G={memory:{encode:"extra",mode:"strict",threshold:7},speed:{encode:"icase",mode:"strict",threshold:7,depth:2},match:{encode:"extra",mode:"full"},score:{encode:"extra",mode:"strict",threshold:5,depth:4},balance:{encode:"balance",mode:"ngram",threshold:6,depth:3},
fastest:{encode:"icase",mode:"strict",threshold:9,depth:1}},B=[],O=0,D={add:0,update:1,remove:2},K=d("[ -/]"),L={},M={};f.new=function(a){return new this(a)};f.create=function(a){return f.new(a)};f.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&(B[B.length]=d(b),B[B.length]=a[b]);return this};f.registerEncoder=function(a,b){A[a]=b;return this};f.registerLanguage=function(a,b){L[a]=b.filter;M[a]=b.stemmer;return this};f.encode=function(a,b){return A[a].call(A,b)};f.prototype.init=
function(a){this.C=[];a||(a=x);var b=a.profile,e=b?G[b]:{};if(b=a.worker)if("undefined"===typeof Worker)a.worker=!1,a.async=!0,this.i=null;else{var c=this;b=parseInt(b,10)||4;c.s=-1;c.m=0;c.g=[];c.A=null;c.i=Array(b);for(var d=0;d<b;d++)c.i[d]=U(c.id,d,a||x,function(a,b,e,d){c.m!==c.c&&(c.g=c.g.concat(e),c.m++,d&&c.g.length>=d&&(c.m=c.c),c.A&&c.m===c.c&&("undefined"!==typeof c.a&&(c.g.length?c.a="":c.a||(c.a=b)),c.cache&&c.j.set(b,c.g),c.A(c.g),c.g=[]))})}this.mode=a.mode||e.mode||this.mode||x.mode;
this.async=a.async||this.async||x.async;this.c=a.worker||this.c||x.c;this.threshold=a.threshold||e.threshold||this.threshold||x.threshold;this.depth=a.depth||e.depth||this.depth||x.depth;this.w=a.suggest||this.w||x.w;this.v=(b=a.encode||e.encode)&&A[b]||("function"===typeof b?b:this.v||!1);this.F=a.debug||this.F;(b=a.matcher)&&this.addMatcher(b);if(b=a.filter)this.filter=P(L[b]||b,this.v);if(b=a.stemmer)this.stemmer=Q(M[b]||b,this.v);this.l=[{},{},{},{},{},{},{},{},{},{}];this.o={};this.b={};this.h=
{};this.f=[];this.D=null;this.u=!0;if("forward"===this.mode||"reverse"===this.mode||"both"===this.mode)this.a="";this.j=(this.cache=b=a.cache||this.cache||x.cache)?new V(b):!1;return this};f.prototype.encode=function(a){a&&B.length&&(a=y(a,B));a&&this.C.length&&(a=y(a,this.C));a&&this.v&&(a=this.v.call(A,a));a&&this.stemmer&&(a=y(a,this.stemmer));return a};f.prototype.addMatcher=function(a){var b=this.C,e;for(e in a)a.hasOwnProperty(e)&&(b[b.length]=d(e),b[b.length]=a[e]);return this};f.prototype.add=
function(a,b,e){if("string"===typeof b&&b&&(a||0===a))if(this.b[a]&&!e)this.update(a,b);else{if(this.c)return++this.s>=this.i.length&&(this.s=0),this.i[this.s].postMessage(this.s,{add:!0,id:a,content:b}),this.b[a]=""+this.s,this;if(this.async)return this.h[a]||(this.f[this.f.length]=a),this.h[a]=[D.add,a,b],F(this),this;b=this.encode(b);if(!b.length)return this;e=this.mode;b="function"===typeof e?e(b):"ngram"===e?H(b):b.split(K);for(var c={_ctx:{}},d=this.threshold,t=this.depth,g=this.l,h=b.length,
f=0;f<h;f++){var m=b[f];if(m){var p=m.length,u=(h-f)/h;switch(e){case "reverse":case "both":for(var n="",l=p-1;1<=l;l--)n=m[l]+n,z(g,c,n,a,(p-l)/p,u,d);case "forward":n="";for(l=0;l<p;l++)n+=m[l],z(g,c,n,a,1,u,d);break;case "full":for(l=0;l<p;l++)for(var q=(p-l)/p,r=p;r>l;r--)n=m.substring(l,r),z(g,c,n,a,q,u,d);break;default:if(l=z(g,c,m,a,1,u,d),t&&1<h&&l>=d)for(p=c._ctx[m]||(c._ctx[m]={}),m=this.o[m]||(this.o[m]=[{},{},{},{},{},{},{},{},{},{}]),l=f-t,r=f+t+1,0>l&&(l=0),r>h&&(r=h);l<r;l++)l!==f&&
z(m,p,b[l],a,0,10-(l<f?f-l:l-f),d)}}}this.b[a]="1";this.u=!1}return this};f.prototype.update=function(a,b){this.b[a]&&b&&"string"===typeof b&&(this.remove(a),this.add(a,b,!0));return this};f.prototype.remove=function(a){if(this.b[a]){if(this.c){var b=parseInt(this.b[a],10);this.i[b].postMessage(b,{remove:!0,id:a});delete this.b[a];return this}if(this.async)return this.h[a]||(this.f[this.f.length]=a),this.h[a]=[D.remove,a],F(this),this;for(b=0;10>b;b++)q(this.l[b],a);this.depth&&q(this.o,a);delete this.b[a];
this.u=!1}return this};f.prototype.search=function(a,b,e){var c=[];if(a&&"object"===typeof a){e=a.callback||b;b=a.limit;var d=a.threshold;a=a.query}d=(d||this.threshold||0)|0;"function"===typeof b?(e=b,b=1E3):b||(b=1E3);if(this.c){this.A=e;this.m=0;this.g=[];for(c=0;c<this.c;c++)this.i[c].postMessage(c,{search:!0,limit:b,threshold:d,content:a});return null}if(e){var f=this;I(function(){e(f.search(a,b));f=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return c;var g=a;if(!this.u)this.cache&&
("undefined"!==typeof this.a&&(this.a=""),this.j.reset()),this.u=!0;else if(this.cache){var h=this.j.get(a);if(h)return h}else if("undefined"!==typeof this.a&&this.a&&0===a.indexOf(this.a))return c;g=this.encode(g);if(!g.length)return c;h=this.mode;g="function"===typeof h?h(g):"ngram"===h?H(g):g.split(K);h=g.length;var q=!0,m=[],p={};if(1<h)if(this.depth){var u=!0,n=g[0];p[n]="1"}else g.sort(R);var l;if(!u||(l=this.o)[n])for(var v=u?1:0;v<h;v++){var r=g[v];if(r&&!p[r]){for(var w,x=!1,y=[],z=0,A=9;A>=
d;A--)if(w=(u?l[n]:this.l)[A][r])y[z++]=w,x=!0;if(x)m[m.length]=1<z?m.concat.apply([],y):y[0];else if(!this.w){q=!1;break}p[r]="1"}n=r}else q=!1;q&&(c=T(m,b,this.w));"undefined"!==typeof this.a&&(c.length?this.a="":this.a||(this.a=a));this.cache&&this.j.set(a,c);return c};f.prototype.info=function(){if(this.c)for(var a=0;a<this.c;a++)this.i[a].postMessage(a,{info:!0,id:this.id});else{for(var b,e,c=0,d=0,f=0,g=0;10>g;g++)for(b=Object.keys(this.l[g]),a=0;a<b.length;a++)e=this.l[g][b[a]].length,c+=e+
2*b[a].length+4,d+=e,f+=2*b[a].length;b=Object.keys(this.b);e=b.length;for(a=0;a<e;a++)c+=2*b[a].length+2;return{id:this.id,memory:c,items:e,sequences:d,chars:f,status:this.u,cache:this.f.length,matcher:B.length,worker:this.c}}};f.prototype.reset=function(){this.destroy();return this.init()};f.prototype.destroy=function(){this.cache&&(this.j.reset(),this.j=null);this.filter=this.stemmer=this.l=this.o=this.b=this.h=this.f=null;return this};var A={icase:function(a){return a.toLowerCase()},simple:function(){var a=
[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s\\s+")," "];return function(b){b=y(b.toLowerCase(),a);return" "!==b?b:""}}(),advanced:function(){var a=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),
"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(b,d){if(!b)return b;b=this.simple(b);2<b.length&&(b=y(b,a));d||1<b.length&&(b=E(b));return b}}(),extra:function(){var a=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(var d=0;d<b.length;d++){var c=b[d];
1<c.length&&(b[d]=c[0]+y(c.substring(1),a))}b=b.join(" ");b=E(b)}return b}}(),balance:function(){var a=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s\\s+")," "];return function(b){return E(y(b.toLowerCase(),a))}}()},I=function(){var a={};return function(b,d,c){var e=a[c];e&&clearTimeout(e);return a[c]=setTimeout(b,d)}}(),V=function(){function a(a){this.reset();this.B=!0!==a&&a}a.prototype.reset=function(){this.cache={};this.count={};this.index={};this.keys=[]};a.prototype.set=function(a,d){if(this.B&&"undefined"===
typeof this.cache[a]){var b=this.keys.length;if(b===this.B){b--;var e=this.keys[b];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[a]=b;this.keys[b]=a;this.count[a]=-1;this.cache[a]=d;this.get(a)}else this.cache[a]=d};a.prototype.get=function(a){var b=this.cache[a];if(this.B&&b){var c=++this.count[a],d=this.index,f=d[a];if(0<f){for(var g=this.keys,h=f;this.count[g[--f]]<=c&&-1!==f;);f++;if(f!==h){for(c=h;c>f;c--)h=g[c-1],g[c]=h,d[h]=c;g[f]=a;d[a]=f}}}return b};return a}();
return f}(function(){var v={},C=!("undefined"===typeof Blob||"undefined"===typeof URL||!URL.createObjectURL);return function(f,w,d,y,z){var q=f;f=C?URL.createObjectURL(new Blob(["var SUPPORT_WORKER = true;var SUPPORT_BUILTINS = true;var SUPPORT_DEBUG = true;var SUPPORT_CACHE = true;var SUPPORT_ASYNC = true;("+d.toString()+")()"],{type:"text/javascript"})):"../"+q+".js";q+="-"+w;v[q]||(v[q]=[]);v[q][z]=new Worker(f);v[q][z].onmessage=y;console.log("Register Worker: "+q+"@"+z);return{postMessage:function(d,
f){v[q][d].postMessage(f)}}}}()),this);
'use strict';(function(v,B,f){var w;(w=f.define)&&w.amd?w([],function(){return B}):(w=f.modules)?w[v.toLowerCase()]=B:"object"===typeof exports?module.exports=B:f[v]=B})("FlexSearch",function O(v){function f(a){"string"===typeof a&&(a=H[a]);a||(a=y);this.id=a.id||P++;this.init(a);w(this,"index",function(){return this.a});w(this,"length",function(){return Object.keys(this.a).length})}function w(a,b,e){Object.defineProperty(a,b,{get:e})}function d(a){return new RegExp(a,"g")}function x(a,b,e){if("undefined"===
typeof e){for(e=0;e<b.length;e+=2)a=a.replace(b[e],b[e+1]);return a}return a.replace(b,e)}function z(a,b,e,c,k,u,g){if(b[e])return b[e];k=k?(9-(g||6))*u+(g||6)*k:u;b[e]=k;k>=g&&(a=a[k+.5>>0],a=a[e]||(a[e]=[]),a[a.length]=c);return k}function q(a,b){if(a)for(var e=Object.keys(a),c=0,k=e.length;c<k;c++){var u=e[c],g=a[u];if(g)for(var h=0,d=g.length;h<d;h++)if(g[h]===b){1===d?delete a[u]:g.splice(h,1);break}else"object"===typeof g[h]&&q(g[h],b)}}function I(a){var b=[];if(!a)return b;for(var e=0,c=0,
k=0,u="",g=a.length,h=0;h<g;h++){var d=a[h];"a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d?e++:c++;" "!==d&&(u+=d);if(" "===d||e>=(8<g?2:1)&&2<=c||2<=e&&c>=(8<g?2:1)||h===g-1)u&&(b[k]&&2<u.length&&k++,b[k]=b[k]?b[k]+u:u," "===d&&k++,u=""),c=e=0}return b}function E(a){for(var b="",e="",c="",k=0;k<a.length;k++){var d=a[k];if(d!==e)if(k&&"h"===d){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e)&&c||" "===e)b+=d}else b+=d;c=k===a.length-
1?"":a[k+1];e=d}return b}function Q(a,b){var e={};if(a)for(var c=0;c<a.length;c++){var k=b?b(a[c]):a[c];e[k]=String.fromCharCode(65E3-a.length+c)}return e}function R(a,b){var e=[];if(a)for(var c in a)if(a.hasOwnProperty(c)){var k=b?b(c):c;e.push(d("(?=.{"+(k.length+3)+",})"+k+"$"),b?b(a[c]):a[c])}return e}function S(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function T(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function U(a,b,e){var c=[],k=[],d=a.length;if(1<d){a.sort(T);for(var g={},h=a[0],C=
h.length,m=0;m<C;)g[h[m++]]=1;for(var n,p=0,l=1;l<d;){var f=!1,q=l===d-1;k=[];h=a[l];C=h.length;for(m=-1;m<C;)if(n=h[++m],g[n]){var r=g[n];if(r===l){if(q){if(c[p++]=n,b&&p===b)return c}else g[n]=l+1;f=!0}else e&&(r=k[r]?k[r]:k[r]=[],r[r.length]=n)}if(!f&&!e)break;l++}if(e&&(p=c.length,(C=k.length)&&(!b||p<b)))for(l=C-1;0<=l;l--)if(n=k[l])for(m=0;m<n.length;m++)if(c[p++]=n[m],b&&p===b)return c}else d&&(c=a[0],b&&c.length>b&&(c=c.slice(0,b)));return c}function F(a){a.C||(a.C=J(function(){a.C=0;var b=
a.async;b&&(a.async=!1);if(a.c.length){for(var e=Date.now(),c;(c=a.c.shift())||0===c;){var d=a.f[c];switch(d[0]){case D.add:a.add(d[1],d[2]);break;case D.remove:a.remove(d[1])}delete a.f[c];if(100<Date.now()-e)break}a.c.length&&F(a)}b&&(a.async=b)},1,"search-async-"+a.id))}function K(a){for(var b=Array(a),e=0;e<a;e++)b[e]={};return b}function V(a,b,e,c){a=v("flexsearch","id"+a,function(){var a,b;self.onmessage=function(c){if(c=c.data)if(c.search){var e=b.search(c.content,c.threshold?{limit:c.limit,
threshold:c.threshold}:c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:e})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.register&&(a=c.id,c.options.cache=!1,c.options.async=!0,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}},function(a){(a=a.data)&&a.result&&c(a.id,a.content,a.result,a.limit)},b);var d=O.toString();e.id=b;
a.postMessage(b,{register:d,options:e,id:b});return a}var y={encode:"icase",mode:"forward",s:!1,cache:!1,async:!1,b:!1,threshold:0,depth:0},H={memory:{encode:"extra",mode:"strict",threshold:7},speed:{encode:"icase",mode:"strict",threshold:7,depth:2},match:{encode:"extra",mode:"full"},score:{encode:"extra",mode:"strict",threshold:5,depth:4},balance:{encode:"balance",mode:"strict",threshold:6,depth:3},fastest:{encode:"icase",mode:"strict",threshold:9,depth:1}},G=[],P=0,D={add:0,update:1,remove:2},L=
d("[ -/]"),M={},N={};f.create=function(a){return new this(a)};f.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&G.push(d(b),a[b]);return this};f.registerEncoder=function(a,b){A[a]=b.bind(A);return this};f.registerLanguage=function(a,b){M[a]=b.filter;N[a]=b.stemmer;return this};f.encode=function(a,b){return A[a](b)};f.prototype.init=function(a){this.B=[];a||(a=y);var b=a.profile,e=b?H[b]:{};if(b=a.worker)if(Worker){var c=this;b=parseInt(b,10)||4;c.l=-1;c.m=0;c.g=[];c.A=null;c.i=Array(b);
for(var d=0;d<b;d++)c.i[d]=V(c.id,d,a,function(a,b,e,d){if(c.m!==c.b)return c.g=c.g.concat(e),c.m++,d&&c.g.length>=d&&(c.m=c.b),c.A&&c.m===c.b&&(c.cache&&c.h.set(b,c.g),c.A(c.g),c.g=[]),c})}else a.worker=!1,this.i=null;this.mode=a.mode||e.mode||this.mode||y.mode;this.async=a.async||this.async||y.async;this.b=a.worker||this.b||y.b;this.threshold=a.threshold||e.threshold||this.threshold||y.threshold;this.depth=a.depth||e.depth||this.depth||y.depth;this.s=a.suggest||this.s||y.s;this.o=(b=a.encode||e.encode)&&
A[b]&&A[b].bind(A)||("function"===typeof b?b:this.o||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter)this.filter=Q(M[b]||b,this.o);if(b=a.stemmer)this.stemmer=R(N[b]||b,this.o);this.v=K(10);this.j={};this.a={};this.f={};this.c=[];this.C=0;this.u=!0;this.h=(this.cache=b=a.cache||this.cache||y.cache)?new W(b):!1;return this};f.prototype.encode=function(a){a&&G.length&&(a=x(a,G));a&&this.B.length&&(a=x(a,this.B));a&&this.o&&(a=this.o(a));a&&this.stemmer&&(a=x(a,this.stemmer));return a};f.prototype.addMatcher=
function(a){var b=this.B,e;for(e in a)a.hasOwnProperty(e)&&b.push(d(e),a[e]);return this};f.prototype.add=function(a,b,e){if(b&&"string"===typeof b&&(a||0===a))if(this.a[a]&&!e)this.update(a,b);else{if(this.b)return++this.l>=this.i.length&&(this.l=0),this.i[this.l].postMessage(this.l,{add:!0,id:a,content:b}),this.a[a]=""+this.l,this;if(this.async)return this.f[a]||(this.c[this.c.length]=a),this.f[a]=[D.add,a,b],F(this),this;b=this.encode(b);if(!b.length)return this;e=this.mode;b="function"===typeof e?
e(b):"ngram"===e?I(b):b.split(L);for(var c={_ctx:{}},d=this.threshold,u=this.depth,g=this.v,h=b.length,f=0;f<h;f++){var m=b[f];if(m){var n=m.length,p=(h-f)/h,l="";switch(e){case "reverse":case "both":for(var t=n-1;1<=t;t--)l=m[t]+l,z(g,c,l,a,(n-t)/n,p,d);l="";case "forward":for(t=0;t<n;t++)l+=m[t],z(g,c,l,a,1,p,d);break;case "full":for(t=0;t<n;t++)for(var q=(n-t)/n,r=n;r>t;r--)l=m.substring(t,r),z(g,c,l,a,q,p,d);break;default:if(n=z(g,c,m,a,1,p,d),u&&1<h&&n>=d)for(n=c._ctx[m]||(c._ctx[m]={}),m=this.j[m]||
(this.j[m]=K(10)),p=f-u,l=f+u+1,0>p&&(p=0),l>h&&(l=h);p<l;p++)p!==f&&z(m,n,b[p],a,0,10-(p<f?f-p:p-f),d)}}}this.a[a]="1";this.u=!1}return this};f.prototype.update=function(a,b){this.a[a]&&b&&"string"===typeof b&&(this.remove(a),this.add(a,b,!0));return this};f.prototype.remove=function(a){if(this.a[a]){if(this.b){var b=parseInt(this.a[a],10);this.i[b].postMessage(b,{remove:!0,id:a});delete this.a[a];return this}if(this.async)return this.f[a]||(this.c[this.c.length]=a),this.f[a]=[D.remove,a],F(this),
this;for(b=0;10>b;b++)q(this.v[b],a);this.depth&&q(this.j,a);delete this.a[a];this.u=!1}return this};f.prototype.search=function(a,b,e){var c=[];if("object"===typeof a){e=a.callback||b;b=a.limit;var d=a.threshold;a=a.query}d||(d=this.threshold||0);"function"===typeof b?(e=b,b=1E3):b||0===b||(b=1E3);if(this.b)for(this.A=e,this.m=0,this.g=[],c=0;c<this.b;c++)this.i[c].postMessage(c,{search:!0,limit:b,threshold:d,content:a});else if(e){var f=this;J(function(){e(f.search(a,b));f=null},1,"search-"+this.id)}else{if(!a||
"string"!==typeof a)return c;var g=a;if(this.cache)if(this.u){var h=this.h.get(a);if(h)return h}else this.h.clear(),this.u=!0;g=this.encode(g);if(!g.length)return c;h=this.mode;g="function"===typeof h?h(g):"ngram"===h?I(g):g.split(L);h=g.length;var q=!0,m=[],n={};if(1<h)if(this.depth){var p=!0;var l=g[0];n[l]="1"}else g.sort(S);var t;if(!p||(t=this.j)[l])for(var v=p?1:0;v<h;v++){var r=g[v];if(r&&!n[r]){for(var w=void 0,y=!1,x=[],z=0,A=9;A>=d;A--)w=(p?t[l]:this.v)[A],w[r]&&(x[z++]=w[r],y=!0);if(y)m[m.length]=
1<z?m.concat.apply([],x):x[0];else if(!this.s){q=!1;break}n[r]="1"}l=r}else q=!1;q&&(c=U(m,b,this.s));this.cache&&this.h.set(a,c);return c}};f.prototype.clear=function(){this.destroy();return this.init()};f.prototype.destroy=function(){this.cache&&(this.h.clear(),this.h=null);this.filter=this.stemmer=this.v=this.j=this.a=this.f=this.c=null;return this};var A={icase:function(a){return a.toLowerCase()},simple:function(){var a=[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),
"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s\\s+")," "];return function(b){b=x(b.toLowerCase(),a);return" "!==b?b:""}}(),advanced:function(){var a=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",
d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(b,d){if(!b)return b;b=this.simple(b);2<b.length&&(b=x(b,a));d||1<b.length&&(b=E(b));return b}}(),extra:function(){var a=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(var d=0;d<b.length;d++){var c=b[d];1<c.length&&(b[d]=c[0]+x(c.substring(1),a))}b=b.join(" ");b=E(b)}return b}}(),
balance:function(){var a=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s\\s+")," "];return function(b){return E(x(b.toLowerCase(),a))}}()},J=function(){var a={};return function(b,d,c){var e=a[c];e&&clearTimeout(e);return a[c]=setTimeout(b,d)}}(),W=function(){function a(a){this.clear();this.w=!0!==a&&a}a.prototype.clear=function(){this.cache={};this.count={};this.index={};this.a=[]};a.prototype.set=function(a,d){if(this.w&&"undefined"===typeof this.cache[a]){var b=this.a.length;if(b===this.w){b--;var e=this.a[b];
delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[a]=b;this.a[b]=a;this.count[a]=-1;this.cache[a]=d;this.get(a)}else this.cache[a]=d};a.prototype.get=function(a){var b=this.cache[a];if(this.w&&b){var c=++this.count[a],d=this.index,f=d[a];if(0<f){for(var g=this.a,h=f;this.count[g[--f]]<=c&&-1!==f;);f++;if(f!==h){for(c=h;c>f;c--)h=g[c-1],g[c]=h,d[h]=c;g[f]=a;d[a]=f}}}return b};return a}();return f}(function(){var v=Object.create(null),B=!("undefined"===typeof Blob||"undefined"===
typeof URL||!URL.createObjectURL);return function(f,w,d,x,z){var q=f;f=B?URL.createObjectURL(new Blob(["("+d.toString()+")()"],{type:"text/javascript"})):"../"+q+".min.js";q+="-"+w;v[q]||(v[q]=[]);v[q][z]=new Worker(f);v[q][z].onmessage=x;return{postMessage:function(d,f){v[q][d].postMessage(f)}}}}()),this);

@@ -1,175 +0,178 @@

/** @define {boolean} */
var SUPPORT_LANG_DE = true;
/** @define {boolean} */ const SUPPORT_LANG_DE = true;
if(SUPPORT_LANG_DE) (function(root){
if(SUPPORT_LANG_DE) {
root['FlexSearch']['registerLanguage']('de', /** @const */ {
// noinspection ThisExpressionReferencesGlobalObjectJS
(function(root){
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
* @export
*/
root["FlexSearch"]["registerLanguage"]("de", /** @const */ {
filter: [
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
* @export
*/
"aber",
"als",
"am",
"an",
"auch",
"auf",
"aus",
"bei",
"bin",
"bis",
"bist",
"da",
"dadurch",
"daher",
"darum",
"das",
"daß",
"dass",
"dein",
"deine",
"dem",
"den",
"der",
"des",
"dessen",
"deshalb",
"die",
"dies",
"dieser",
"dieses",
"doch",
"dort",
"du",
"durch",
"ein",
"eine",
"einem",
"einen",
"einer",
"eines",
"er",
"es",
"euer",
"eure",
"für",
"hatte",
"hatten",
"hattest",
"hattet",
"hier",
"hinter",
"ich",
"ihr",
"ihre",
"im",
"in",
"ist",
"ja",
"jede",
"jedem",
"jeden",
"jeder",
"jedes",
"jener",
"jenes",
"jetzt",
"kann",
"kannst",
"können",
"könnt",
"machen",
"mein",
"meine",
"mit",
"muß",
"mußt",
"musst",
"müssen",
"müßt",
"nach",
"nachdem",
"nein",
"nicht",
"nun",
"oder",
"seid",
"sein",
"seine",
"sich",
"sie",
"sind",
"soll",
"sollen",
"sollst",
"sollt",
"sonst",
"soweit",
"sowie",
"und",
"unser",
"unsere",
"unter",
"vom",
"von",
"vor",
"wann",
"warum",
"was",
"weiter",
"weitere",
"wenn",
"wer",
"werde",
"werden",
"werdet",
"weshalb",
"wie",
"wieder",
"wieso",
"wir",
"wird",
"wirst",
"wo",
"woher",
"wohin",
"zu",
"zum",
"zur",
"über"
],
filter: [
/**
* @type {Object<string, string>}
* @export
*/
"aber",
"als",
"am",
"an",
"auch",
"auf",
"aus",
"bei",
"bin",
"bis",
"bist",
"da",
"dadurch",
"daher",
"darum",
"das",
"daß",
"dass",
"dein",
"deine",
"dem",
"den",
"der",
"des",
"dessen",
"deshalb",
"die",
"dies",
"dieser",
"dieses",
"doch",
"dort",
"du",
"durch",
"ein",
"eine",
"einem",
"einen",
"einer",
"eines",
"er",
"es",
"euer",
"eure",
"für",
"hatte",
"hatten",
"hattest",
"hattet",
"hier",
"hinter",
"ich",
"ihr",
"ihre",
"im",
"in",
"ist",
"ja",
"jede",
"jedem",
"jeden",
"jeder",
"jedes",
"jener",
"jenes",
"jetzt",
"kann",
"kannst",
"können",
"könnt",
"machen",
"mein",
"meine",
"mit",
"muß",
"mußt",
"musst",
"müssen",
"müßt",
"nach",
"nachdem",
"nein",
"nicht",
"nun",
"oder",
"seid",
"sein",
"seine",
"sich",
"sie",
"sind",
"soll",
"sollen",
"sollst",
"sollt",
"sonst",
"soweit",
"sowie",
"und",
"unser",
"unsere",
"unter",
"vom",
"von",
"vor",
"wann",
"warum",
"was",
"weiter",
"weitere",
"wenn",
"wer",
"werde",
"werden",
"werdet",
"weshalb",
"wie",
"wieder",
"wieso",
"wir",
"wird",
"wirst",
"wo",
"woher",
"wohin",
"zu",
"zum",
"zur",
"über"
],
stemmer: {
/**
* @type {Object<string, string>}
* @export
*/
"niss": "",
"isch": "",
"lich": "",
"heit": "",
"keit": "",
"end": "",
"ung": "",
"est": "",
"ern": "",
"em": "",
"er": "",
"en": "",
"es": "",
"st": "",
"ig": "",
"ik": "",
"e": "",
"s": ""
}
});
stemmer: {
})(this);
"niss": "",
"isch": "",
"lich": "",
"heit": "",
"keit": "",
"end": "",
"ung": "",
"est": "",
"ern": "",
"em": "",
"er": "",
"en": "",
"es": "",
"st": "",
"ig": "",
"ik": "",
"e": "",
"s": ""
}
});
})(this);
}

@@ -1,279 +0,282 @@

/** @define {boolean} */
var SUPPORT_LANG_EN = true;
/** @define {boolean} */ const SUPPORT_LANG_EN = true;
if(SUPPORT_LANG_EN) (function(root){
if(SUPPORT_LANG_EN) {
root['FlexSearch']['registerLanguage']('en', /** @const */ {
// noinspection ThisExpressionReferencesGlobalObjectJS
(function(root){
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
* @export
*/
root["FlexSearch"]["registerLanguage"]("en", /** @const */ {
filter: [
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
* @export
*/
"a",
"about",
"above",
"after",
"again",
"against",
"all",
"also",
"am",
"an",
"and",
"any",
"are",
"aren't",
"as",
"at",
//"back",
"be",
"because",
"been",
"before",
"being",
"below",
//"between",
"both",
"but",
"by",
"can",
"cannot",
"can't",
"come",
"could",
"couldn't",
//"day",
"did",
"didn't",
"do",
"does",
"doesn't",
"doing",
"dont",
"down",
"during",
"each",
"even",
"few",
"first",
"for",
"from",
"further",
"get",
//"give",
"go",
//"good",
"had",
"hadn't",
"has",
"hasn't",
"have",
"haven't",
"having",
"he",
"hed",
//"hell",
"her",
"here",
"here's",
"hers",
"herself",
"hes",
"him",
"himself",
"his",
"how",
"how's",
"i",
"id",
"if",
"ill",
"im",
"in",
"into",
"is",
"isn't",
"it",
"it's",
"itself",
"i've",
"just",
"know",
"let's",
"like",
//"look",
"make",
"me",
"more",
"most",
"mustn't",
"my",
"myself",
"new",
"no",
"nor",
"not",
"now",
"of",
"off",
"on",
"once",
//"one",
"only",
"or",
"other",
"ought",
"our",
"our's",
"ourselves",
"out",
"over",
"own",
//"people",
"same",
"say",
"see",
"shan't",
"she",
"she'd",
"shell",
"shes",
"should",
"shouldn't",
"so",
"some",
"such",
//"take",
"than",
"that",
"that's",
"the",
"their",
"theirs",
"them",
"themselves",
"then",
"there",
"there's",
"these",
"they",
"they'd",
"they'll",
"they're",
"they've",
//"think",
"this",
"those",
"through",
"time",
"to",
"too",
//"two",
//"under",
"until",
"up",
"us",
//"use",
"very",
"want",
"was",
"wasn't",
"way",
"we",
"wed",
"well",
"were",
"weren't",
"we've",
"what",
"what's",
"when",
"when's",
"where",
"where's",
"which",
"while",
"who",
"whom",
"who's",
"why",
"why's",
"will",
"with",
"won't",
//"work",
"would",
"wouldn't",
//"year",
"you",
"you'd",
"you'll",
"your",
"you're",
"your's",
"yourself",
"yourselves",
"you've"
],
filter: [
/**
* @type {Object<string, string>}
* @export
*/
"a",
"about",
"above",
"after",
"again",
"against",
"all",
"also",
"am",
"an",
"and",
"any",
"are",
"aren't",
"as",
"at",
//"back",
"be",
"because",
"been",
"before",
"being",
"below",
//"between",
"both",
"but",
"by",
"can",
"cannot",
"can't",
"come",
"could",
"couldn't",
//"day",
"did",
"didn't",
"do",
"does",
"doesn't",
"doing",
"dont",
"down",
"during",
"each",
"even",
"few",
"first",
"for",
"from",
"further",
"get",
//"give",
"go",
//"good",
"had",
"hadn't",
"has",
"hasn't",
"have",
"haven't",
"having",
"he",
"hed",
//"hell",
"her",
"here",
"here's",
"hers",
"herself",
"hes",
"him",
"himself",
"his",
"how",
"how's",
"i",
"id",
"if",
"ill",
"im",
"in",
"into",
"is",
"isn't",
"it",
"it's",
"itself",
"i've",
"just",
"know",
"let's",
"like",
//"look",
"make",
"me",
"more",
"most",
"mustn't",
"my",
"myself",
"new",
"no",
"nor",
"not",
"now",
"of",
"off",
"on",
"once",
//"one",
"only",
"or",
"other",
"ought",
"our",
"our's",
"ourselves",
"out",
"over",
"own",
//"people",
"same",
"say",
"see",
"shan't",
"she",
"she'd",
"shell",
"shes",
"should",
"shouldn't",
"so",
"some",
"such",
//"take",
"than",
"that",
"that's",
"the",
"their",
"theirs",
"them",
"themselves",
"then",
"there",
"there's",
"these",
"they",
"they'd",
"they'll",
"they're",
"they've",
//"think",
"this",
"those",
"through",
"time",
"to",
"too",
//"two",
//"under",
"until",
"up",
"us",
//"use",
"very",
"want",
"was",
"wasn't",
"way",
"we",
"wed",
"well",
"were",
"weren't",
"we've",
"what",
"what's",
"when",
"when's",
"where",
"where's",
"which",
"while",
"who",
"whom",
"who's",
"why",
"why's",
"will",
"with",
"won't",
//"work",
"would",
"wouldn't",
//"year",
"you",
"you'd",
"you'll",
"your",
"you're",
"your's",
"yourself",
"yourselves",
"you've"
],
stemmer: {
/**
* @type {Object<string, string>}
* @export
*/
"ational": "ate",
"iveness": "ive",
"fulness": "ful",
"ousness": "ous",
"ization": "ize",
"tional": "tion",
"biliti": "ble",
"icate": "ic",
"ative": "",
"alize": "al",
"iciti": "ic",
"entli": "ent",
"ousli": "ous",
"alism": "al",
"ation": "ate",
"aliti": "al",
"iviti": "ive",
"ement": "",
"enci": "ence",
"anci": "ance",
"izer": "ize",
"alli": "al",
"ator": "ate",
"logi": "log",
"ical": "ic",
"ance": "",
"ence": "",
"ness": "",
"able": "",
"ible": "",
"ment": "",
"eli": "e",
"bli": "ble",
"ful": "",
"ant": "",
"ent": "",
"ism": "",
"ate": "",
"iti": "",
"ous": "",
"ive": "",
"ize": "",
"al": "",
"ou": "",
"er": "",
"ic": ""
}
});
stemmer: {
})(this);
"ational": "ate",
"iveness": "ive",
"fulness": "ful",
"ousness": "ous",
"ization": "ize",
"tional": "tion",
"biliti": "ble",
"icate": "ic",
"ative": "",
"alize": "al",
"iciti": "ic",
"entli": "ent",
"ousli": "ous",
"alism": "al",
"ation": "ate",
"aliti": "al",
"iviti": "ive",
"ement": "",
"enci": "ence",
"anci": "ance",
"izer": "ize",
"alli": "al",
"ator": "ate",
"logi": "log",
"ical": "ic",
"ance": "",
"ence": "",
"ness": "",
"able": "",
"ible": "",
"ment": "",
"eli": "e",
"bli": "ble",
"ful": "",
"ant": "",
"ent": "",
"ism": "",
"ate": "",
"iti": "",
"ous": "",
"ive": "",
"ize": "",
"al": "",
"ou": "",
"er": "",
"ic": ""
}
});
})(this);
}
{
"name": "flexsearch",
"version": "0.2.481",
"version": "0.3.0",
"description": "Next-Generation full text search library with zero dependencies.",
"homepage": "https://nextapps-de.github.io/xone/",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",

@@ -27,7 +27,8 @@ "copyright": "Nextapps GmbH",

"scripts": {
"build": "node compile RELEASE=min SUPPORT_DEBUG=true SUPPORT_WORKER=true SUPPORT_BUILTINS=true SUPPORT_CACHE=true SUPPORT_ASYNC=true && exit 0",
"build-light": "node compile RELEASE=light && exit 0",
"build-custom": "node compile",
"build-lang": "node compile RELEASE=lang && exit 0",
"build-all": "npm run build && npm run build-light && npm run build-lang",
"build": "node compile RELEASE=min DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false",
"build-light": "node compile RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_PRESETS=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false",
"build-compact": "node compile RELEASE=compact DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_PRESETS=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false",
"build-custom": "node compile RELEASE=custom DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_PRESETS=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false",
"build-lang": "node compile RELEASE=lang",
"build-all": "npm run build && npm run build-light && npm run build-compact && npm run build-lang",
"test-production": "nyc --reporter=html --reporter=text mocha --timeout=3000 test --exit",

@@ -37,3 +38,3 @@ "test-light": "nyc --reporter=html --reporter=text mocha --timeout=3000 test/ --exit",

"test-browser": "mocha-phantomjs test/index.html",
"test": "npm run test-develop && npm run test-production && npm run test-browser",
"test": "npm run test-develop && npm run test-production && npm run test-light && npm run test-browser",
"update": "node_modules/.bin/updtr --to non-breaking",

@@ -51,11 +52,13 @@ "coverage": "nyc report --reporter=lcov --reporter=text-lcov | coveralls"

],
"readme": "README.md",
"dependencies": {},
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"google-closure-compiler": "^20180204.0.0",
"mocha": "^5.0.4",
"chai": "^4.2.0",
"codacy-coverage": "^3.4.0",
"coveralls": "^3.0.2",
"google-closure-compiler": "^20190124.0.0-nightly",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0",
"mocha-phantomjs": "^4.1.0",
"nyc": "^11.6.0",
"nyc": "^13.1.0",
"phantomjs-prebuilt": "^2.1.16",

@@ -62,0 +65,0 @@ "updtr": "^2.0.0"

@@ -1,2 +0,1 @@

<p align="center"></p>
<p align="center">

@@ -7,12 +6,15 @@ <br>

<a target="_blank" href="https://www.npmjs.com/package/flexsearch"><img src="https://img.shields.io/npm/v/flexsearch.svg"></a>
<img src="https://img.shields.io/badge/status-BETA-orange.svg">
<!--<img src="https://img.shields.io/badge/status-BETA-orange.svg">-->
<a target="_blank" href="https://travis-ci.org/nextapps-de/flexsearch"><img src="https://travis-ci.org/nextapps-de/flexsearch.svg?branch=master"></a>
<a target="_blank" href="https://coveralls.io/github/nextapps-de/flexsearch?branch=master"><img src="https://coveralls.io/repos/github/nextapps-de/flexsearch/badge.svg?branch=master"></a>
<a target="_blank" href="https://github.com/nextapps-de/flexsearch/issues"><img src="https://img.shields.io/github/issues/nextapps-de/xone.svg"></a><!--<img src="https://badges.greenkeeper.io/nextapps-de/flexsearch.svg">-->
<a target="_blank" href="https://www.codacy.com/app/ts-thomas/FlexSearch?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nextapps-de/flexsearch&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/a896e010f6b4429aa7bc9a89550320a7"/></a>
<a target="_blank" href="https://github.com/nextapps-de/flexsearch/issues"><img src="https://img.shields.io/github/issues/nextapps-de/xone.svg"></a>
<!--<img src="https://badges.greenkeeper.io/nextapps-de/flexsearch.svg">-->
<a target="_blank" href="https://github.com/nextapps-de/flexsearch/blob/master/LICENSE.md"><img src="https://img.shields.io/npm/l/xone.svg"></a>
</p>
<h1></h1>
<h3>World's fastest and most memory efficient full text search library with zero dependencies.</h3>
When it comes to raw search speed <a href="https://jsperf.com/compare-search-libraries" target="_blank">FlexSearch outperforms every single searching library out there</a> and also provides flexible search capabilities like multi-word matching, phonetic transformations or partial matching.
When it comes to raw search speed <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">FlexSearch outperforms every single searching library out there</a> and also provides flexible search capabilities like multi-word matching, phonetic transformations or partial matching.
It also has the <a href="#memory">most memory-efficient index</a>. Keep in mind that updating and/or removing existing items from the index has a significant cost. When your index needs to be updated continuously then <a href="bulksearch/" target="_blank">BulkSearch</a> may be a better choice.

@@ -23,7 +25,2 @@ FlexSearch also provides you a non-blocking asynchronous processing model as well as web workers to perform any updates or queries on the index in parallel through dedicated balanced threads.

Comparison:
- <a href="https://jsperf.com/compare-search-libraries" target="_blank">Library Query Benchmarks</a>
- <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">Library Relevance Scoring</a>
- <a href="#consumption">Library Memory Consumption</a>
Supported Platforms:

@@ -33,41 +30,329 @@ - Browser

<!--
Supported Module Definitions:
- AMD (RequireJS)
- CommonJS (Node.js)
- Closure (Xone)
- Global (Browser)
-->
Get Latest (Stable Release):
<table>
<tr></tr>
<tr>
<td>Build</td>
<td>File</td>
<td>CDN</td>
</tr>
<tr>
<td>flexsearch.min.js</td>
<td><a href="https://github.com/nextapps-de/flexsearch/raw/master/flexsearch.min.js" target="_blank">Download</a></td>
<td><a href="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/flexsearch.min.js" target="_blank">https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/flexsearch.min.js</a></td>
</tr>
<tr></tr>
<tr>
<td>flexsearch.light.js</td>
<td><a href="https://github.com/nextapps-de/flexsearch/raw/master/flexsearch.light.js" target="_blank">Download</a></td>
<td><a href="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/flexsearch.light.js" target="_blank">https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/flexsearch.light.js</a></td>
</tr>
<tr></tr>
<tr>
<td>flexsearch.compact.js</td>
<td><a href="https://github.com/nextapps-de/flexsearch/raw/master/flexsearch.compact.js" target="_blank">Download</a></td>
<td><a href="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/flexsearch.compact.js" target="_blank">https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/flexsearch.compact.js</a></td>
</tr>
<tr></tr>
<tr>
<td>flexsearch.custom.js</td>
<td><a href="#builds">Custom Build</a></td>
<td></td>
</tr>
</table>
All Features:
<ul>
<li><a href="#webworker">Web-Worker Sharding</a> (not available in Node.js)</li>
<li><a href="#contextual">Contextual Indexes</a></li>
<li>Partial Matching</li>
<li>Multi-Phrase Search</li>
<li><a href="#phonetic">Phonetic Mathching</a></li>
<li>Relevance-based Scoring</li>
<li>Auto-Balanced Cache by Popularity</li>
<li>Suggestions (Results)</li>
<li>Asynchronous Processing & Concurrency Control</li>
<li>Customizable: Matcher, Encoder, Tokenizer, Stemmer, Filter</li>
</ul>
<table>
<tr></tr>
<tr>
<td>Feature</td>
<td>flexsearch.min.js</td>
<td>flexsearch.compact.js</td>
<td>flexsearch.light.js</td>
</tr>
<tr>
<td>
<a href="#webworker">Web-Worker Sharding</a> (not available in Node.js)
</td>
<td>x</td>
<td>x</td>
<td>-</td>
</tr>
<tr></tr>
<tr>
<td>
<a href="#contextual">Contextual Indexes</a>
</td>
<td>x</td>
<td>x</td>
<td>x</td>
</tr>
<tr></tr>
<tr>
<td>
Partial Matching
</td>
<td>x</td>
<td>x</td>
<td>x</td>
</tr>
<tr></tr>
<tr>
<td>
Multi-Phrase Search
</td>
<td>x</td>
<td>x</td>
<td>x</td>
</tr>
<tr></tr>
<tr>
<td>
Relevance-based Scoring
</td>
<td>x</td>
<td>x</td>
<td>x</td>
</tr>
<tr></tr>
<tr>
<td>
Auto-Balanced Cache by Popularity
</td>
<td>x</td>
<td>x</td>
<td>-</td>
</tr>
<tr></tr>
<tr>
<td>
Suggestions (Results)
</td>
<td>x</td>
<td>x</td>
<td>-</td>
</tr>
<tr></tr>
<tr>
<td>
Asynchronous Processing & Concurrency Control
</td>
<td>x</td>
<td>x</td>
<td>-</td>
</tr>
<tr></tr>
<tr>
<td>
<a href="#phonetic">Phonetic Mathching</a>
</td>
<td>x</td>
<td>x</td>
<td>-</td>
</tr>
<tr></tr>
<tr>
<td>
Customizable: Matcher, Encoder, Tokenizer, Stemmer, Filter
</td>
<td>x</td>
<td>x</td>
<td>x</td>
</tr>
<tr>
<td>File Size (gzip)</td>
<td>6.7 kb</td>
<td>4.5 kb</td>
<td>1.9 kb</td>
</tr>
</table>
These features are not available in the 50% smaller <a href="flexsearch.light.js">light version</a>:
> It is also pretty simple to make <a href="#builds">Custom Builds</a>
- WebWorker
- Asynchronous Processing
- Cache
- Built-in encoders except 'balance' and 'icase' (you can still pass in customs) <!--- Built-in stemmer and filter (you can still pass in customs)-->
- Debug logging
- Methods: _index.info()_
<a name="compare" id="compare"></a>
#### Benchmark Ranking
The light version is just available as compiled version (<a href="flexsearch.light.js">flexsearch.light.js</a>).
- Library Comparison: <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a>
- Library Comparison: <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">Relevance Scoring</a>
- Library Comparison: <a href="#consumption">Memory Consumption</a>
> It is also pretty simple to make <a href="#builds">Custom Builds</a>
__Query Test: "Gulliver's Travels"__
<table>
<tr></tr>
<tr>
<td align="left">Rank</td>
<td align="left">Library Name</td>
<td align="left">Library Version</td>
<td align="left">Library Size</td>
<td align="left">Operations per second</td>
</tr>
<tr>
<td>1</td>
<td>FlexSearch</td>
<td>0.3.0</td>
<td>2.9 kb</td>
<td><b>316336</b></td>
</tr>
<tr></tr>
<tr>
<td>2</td>
<td>Wade</td>
<td>0.3.3</td>
<td>1.6 kb</td>
<td><b>1524</b></td>
</tr>
<tr></tr>
<tr>
<td>3</td>
<td>JS Search</td>
<td>1.4.2</td>
<td>3.8 kb</td>
<td><b>739</b></td>
</tr>
<tr></tr>
<tr>
<td>4</td>
<td>JSii</td>
<td>1.0</td>
<td>3.9 kb</td>
<td><b>544</b></td>
</tr>
<tr></tr>
<tr>
<td>5</td>
<td>Lunr.js</td>
<td>2.3.5</td>
<td>8.8 kb</td>
<td><b>310</b></td>
</tr>
<tr></tr>
<tr>
<td>6</td>
<td>Elasticlunr.js</td>
<td>0.9.6</td>
<td>5.6 kb</td>
<td><b>286</b></td>
</tr>
<tr></tr>
<tr>
<td>7</td>
<td>BulkSearch</td>
<td>0.1.3</td>
<td>3.1 kb</td>
<td><b>265</b></td>
</tr>
<tr></tr>
<tr>
<td>8</td>
<td>bm25</td>
<td>0.2</td>
<td>3.5 kb</td>
<td><b>72</b></td>
</tr>
<tr></tr>
<tr>
<td>9</td>
<td>Fuse</td>
<td>3.3.0</td>
<td>3.7 kb</td>
<td><b>1</b></td>
</tr>
</table>
__Memory Test: "Gulliver's Travels"__
<table>
<tr></tr>
<tr>
<td align="left">Rank</td>
<td align="left">Library Name</td>
<td align="left">Library Version</td>
<td align="left">Index Size <a href="#notes">*</a></td>
<td align="left">Memory Allocation <a href="#notes">**</a></td>
</tr>
<tr>
<td>1</td>
<td>FlexSearch</td>
<td>0.3.0</td>
<td>1.33 Mb</td>
<td>20.31 kb</td>
</tr>
<tr></tr>
<tr>
<td>2</td>
<td>Wade</td>
<td>0.3.3</td>
<td>3.18 Mb</td>
<td>68.53 kb</td>
</tr>
<tr></tr>
<tr>
<td>3</td>
<td>JS Search</td>
<td>1.4.2</td>
<td>36.9 Mb</td>
<td>53.0 kb</td>
</tr>
<tr></tr>
<tr>
<td>4</td>
<td>JSii</td>
<td>1.0</td>
<td>8.9 Mb</td>
<td>81.03 kb</td>
</tr>
<tr></tr>
<tr>
<td>5</td>
<td>Lunr.js</td>
<td>2.3.5</td>
<td>16.24 Mb</td>
<td>84.73 kb</td>
</tr>
<tr></tr>
<tr>
<td>6</td>
<td>Elasticlunr.js</td>
<td>0.9.6</td>
<td>11.83 Mb</td>
<td>68.69 kb</td>
</tr>
<tr></tr>
<tr>
<td>7</td>
<td>BulkSearch</td>
<td>0.1.3</td>
<td>1.53 Mb</td>
<td>984.30 kb</td>
</tr>
<tr></tr>
<tr>
<td>8</td>
<td>bm25</td>
<td>0.2</td>
<td>6.95 Mb</td>
<td>137.88 kb</td>
</tr>
<tr></tr>
<tr>
<td>9</td>
<td>Fuse</td>
<td>3.3.0</td>
<td>0.22 Mb</td>
<td>156.46 kb</td>
</tr>
</table>
<a name="notes" id="notes"></a>
_* Index Size: The size of memory the index requires_<br>
_** Memory Allocation: The amount of memory which was additionally allocated during a row of 10 queries_
Library Comparison: <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a>
<a name="contextual"></a>
#### Contextual Search
FlexSearch introduce a new scoring mechanism called __Contextual Search__ which was invented by Thomas Wilkerling, the author of this library. A Contextual Search <a href="https://jsperf.com/compare-search-libraries" target="_blank">incredibly boost up queries to a complete new level</a>.
FlexSearch introduce a new scoring mechanism called __Contextual Search__ which was invented by Thomas Wilkerling, the author of this library. A Contextual Search <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">incredibly boost up queries to a complete new level</a> but also requires a lot of additionally memory.
The basic idea of this concept is to limit relevance by its context instead of calculating relevance through the whole (unlimited) distance.

@@ -83,2 +368,6 @@ Imagine you add a text block of some sentences to an index ID. Assuming the query includes a combination of first and last word from this text block, are they really relevant to each other?

###### TF-IDF / BM25?
> "TF-IDF and all kinds of variations (like BM25) is a big mistake in searching algorithms today. They don't provide neither: a meaningful relevance of a term nor the importance of it! Like many pseudo-intelligent algorithms this is also just an example of mathematical stupidity." — Thomas Wilkerling, _Contextual-based Scoring_, 2018
<a name="webworker"></a>

@@ -234,3 +523,3 @@ #### Web-Worker Support

- <a href="#index.remove">Index.__remove__(id)</a>
- <a href="#index.reset">Index.__reset__()</a>
- <a href="#index.clear">Index.__clear__()</a>
- <a href="#index.destroy">Index.__destroy__()</a>

@@ -361,2 +650,3 @@ - <a href="#index.init">Index.__init__(\<options\>)</a>

```
<a name="index.remove"></a>

@@ -370,8 +660,9 @@ #### Remove item to the index

```
<a name="index.reset"></a>
<a name="index.clear"></a>
#### Reset index
```js
index.reset();
index.clear();
```
<a name="index.destroy"></a>

@@ -383,2 +674,3 @@ #### Destroy the index

```
<a name="index.init"></a>

@@ -1187,2 +1479,7 @@ #### Re-Initialize index

Compact Build:
```bash
npm run build-compact
```
Light Build:

@@ -1203,15 +1500,2 @@ ```bash

Supported flags:
- SUPPORT_DEBUG
- SUPPORT_WORKER
- SUPPORT_CACHE
- SUPPORT_ASYNC
- SUPPORT_BUILTINS (built-in encoders)
Supported language flags (includes stemmer and filter):
- SUPPORT_LANG_EN
- SUPPORT_LANG_DE
Alternatively you can also use:

@@ -1222,7 +1506,62 @@ ```bash

The custom build was saved to flexsearch.custom.js
> The custom build will be saved to flexsearch.custom.xxxxx.js (the "xxxxx" is a hash based on the used build flags).
__Supported Build Flags__
<table>
<tr></tr>
<tr>
<td align="left">Flag</td>
<td align="left">Values</td>
</tr>
<tr>
<td>SUPPORT_DEBUG</td>
<td>true, false</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_WORKER</td>
<td>true, false</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_CACHE</td>
<td>true, false</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_ASYNC</td>
<td>true, false</td>
</tr>
<tr></tr>
<tr>
<td>SUPPORT_BUILTINS (built-in encoders)</td>
<td>true, false</td>
</tr>
<tr>
<td><br><b>Language Flags </b>(includes stemmer and filter)</td>
<td></td>
</tr>
<tr>
<td>SUPPORT_LANG_EN</td>
<td>true, false</td>
</tr>
<tr></tr>
<tr>
<td><a>SUPPORT_LANG_DE</td>
<td>true, false</td>
</tr>
<tr>
<td><br><b>Compiler Flags</b></td>
<td></td>
</tr>
<tr>
<td>LANGUAGE_OUT<br><br><br><br><br><br><br><br></td>
<td>ECMASCRIPT3<br>ECMASCRIPT5<br>ECMASCRIPT5_STRICT<br>ECMASCRIPT6<br>ECMASCRIPT6_STRICT<br>ECMASCRIPT_2015<br>ECMASCRIPT_2017<br>STABLE</td>
</tr>
</table>
---
Copyright 2018 Thomas Wilkerling<br>
Copyright 2019 Nextapps GmbH<br>
Released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 License</a><br>

@@ -1,2 +0,2 @@

if(typeof module !== 'undefined'){
if(typeof module !== "undefined"){

@@ -9,5 +9,5 @@ // Node.js Stub

var env = process.argv[3] === 'test' ? 'min' : process.argv[3] === 'test/' ? 'light' : '';
var expect = require('chai').expect;
var FlexSearch = require("../flexsearch" + (env ? '.' + env : '') + ".js");
var env = process.argv[3] === "test" ? "min" : process.argv[3] === "test/" ? "light" : "";
var expect = require("chai").expect;
var FlexSearch = require("../flexsearch" + (env ? "." + env : "") + ".js");
}

@@ -37,5 +37,5 @@

describe('Initialize', function(){
describe("Initialize", function(){
it('Should have been initialized successfully', function(){
it("Should have been initialized successfully", function(){

@@ -46,3 +46,3 @@ flexsearch_default = new FlexSearch();

mode: 'forward',
mode: "forward",
encode: false,

@@ -55,3 +55,3 @@ async: false,

mode: 'forward',
mode: "forward",
encode: false,

@@ -64,3 +64,3 @@ async: true,

encode: 'icase',
encode: "icase",
async: false,

@@ -72,3 +72,3 @@ worker: false

encode: 'simple',
encode: "simple",
async: false,

@@ -80,3 +80,3 @@ worker: false

encode: 'advanced',
encode: "advanced",
async: false,

@@ -88,3 +88,3 @@ worker: false

encode: 'extra',
encode: "extra",
async: false,

@@ -103,4 +103,4 @@ worker: false

encode: 'icase',
mode: 'strict',
encode: "icase",
mode: "strict",
async: false,

@@ -112,4 +112,4 @@ worker: false

encode: 'icase',
mode: 'forward',
encode: "icase",
mode: "forward",
async: false,

@@ -121,4 +121,4 @@ worker: false

encode: 'icase',
mode: 'reverse',
encode: "icase",
mode: "reverse",
async: false,

@@ -130,4 +130,4 @@ worker: false

encode: 'icase',
mode: 'full',
encode: "icase",
mode: "full",
async: false,

@@ -139,4 +139,4 @@ worker: false

encode: 'advanced',
mode: 'ngram',
encode: "advanced",
mode: "ngram",
async: false,

@@ -148,4 +148,4 @@ worker: false

encode: 'icase',
mode: 'reverse',
encode: "icase",
mode: "reverse",
cache: true

@@ -159,3 +159,3 @@ });

it('Should have all provided methods', function(){
it("Should have all provided methods", function(){

@@ -166,6 +166,6 @@ expect(flexsearch_default).to.respondTo("search");

expect(flexsearch_default).to.respondTo("remove");
expect(flexsearch_default).to.respondTo("reset");
expect(flexsearch_default).to.respondTo("clear");
expect(flexsearch_default).to.respondTo("init");
if(env !== 'light'){
if(env !== "light" && env !== "min"){

@@ -176,3 +176,3 @@ expect(flexsearch_default).to.respondTo("info");

it('Should have correct uuids', function(){
it("Should have correct uuids", function(){

@@ -188,8 +188,12 @@ expect(flexsearch_default.id).to.equal(0);

it('Should have the correct options', function(){
it("Should have the correct options", function(){
expect(flexsearch_default.async).to.equal(false);
expect(flexsearch_default.mode).to.equal("ngram");
expect(flexsearch_sync.async).to.equal(false);
expect(flexsearch_async.async).to.equal(true);
if(env !== "light"){
expect(flexsearch_default.async).to.equal(false);
expect(flexsearch_sync.async).to.equal(false);
expect(flexsearch_async.async).to.equal(true);
}
expect(flexsearch_default.mode).to.equal("forward");
expect(flexsearch_strict.mode).to.equal("strict");

@@ -202,3 +206,3 @@ expect(flexsearch_forward.mode).to.equal("forward");

// not available in compiled version:
if(typeof flexsearch_custom.encoder !== 'undefined'){
if(typeof flexsearch_custom.encoder !== "undefined"){

@@ -210,5 +214,5 @@ expect(flexsearch_custom.encoder).to.equal(test_encoder);

describe('Add (Sync)', function(){
describe("Add (Sync)", function(){
it('Should have been added to the index', function(){
it("Should have been added to the index", function(){

@@ -223,3 +227,3 @@ flexsearch_sync.add(0, "foo");

it('Should not have been added to the index', function(){
it("Should not have been added to the index", function(){

@@ -243,9 +247,16 @@ flexsearch_sync.add("foo");

expect(flexsearch_extra.length).to.equal(0);
if(env !== "light"){
expect(flexsearch_extra.length).to.equal(0);
}
else{
expect(flexsearch_extra.length).to.equal(1);
}
});
});
describe('Search (Sync)', function(){
describe("Search (Sync)", function(){
it('Should have been matched from index', function(){
it("Should have been matched from index", function(){

@@ -259,3 +270,3 @@ expect(flexsearch_sync.search("foo")).to.have.members([0, 1]);

if(env !== 'light'){
if(env !== "light"){

@@ -272,3 +283,3 @@ flexsearch_extra.add(4, "Thomas");

it('Should have been limited', function(){
it("Should have been limited", function(){

@@ -280,3 +291,3 @@ expect(flexsearch_sync.search("foo", 1)).to.include(0);

it('Should not have been matched from index', function(){
it("Should not have been matched from index", function(){

@@ -291,5 +302,5 @@ expect(flexsearch_sync.search("barfoo")).to.have.lengthOf(0);

describe('Update (Sync)', function(){
describe("Update (Sync)", function(){
it('Should have been updated to the index', function(){
it("Should have been updated to the index", function(){

@@ -318,3 +329,3 @@ flexsearch_sync.update(0, "bar");

it('Should not have been updated to the index', function(){
it("Should not have been updated to the index", function(){

@@ -338,5 +349,5 @@ flexsearch_sync.update("foo");

describe('Remove (Sync)', function(){
describe("Remove (Sync)", function(){
it('Should have been removed from the index', function(){
it("Should have been removed from the index", function(){

@@ -358,5 +369,5 @@ flexsearch_sync.remove(0);

describe('Apply Sort by Scoring', function(){
describe("Apply Sort by Scoring", function(){
it('Should have been sorted properly by scoring', function(){
it("Should have been sorted properly by scoring", function(){

@@ -381,3 +392,3 @@ flexsearch_sync.add(0, "foo bar foobar");

it('Should have been sorted properly by threshold', function(){
it("Should have been sorted properly by threshold", function(){

@@ -409,191 +420,194 @@ flexsearch_reverse.add(0, "foobarxxx foobarfoobarfoobarxxx foobarfoobarfoobaryyy foobarfoobarfoobarzzz");

describe('Add (Async)', function(){
if(env !== "light"){
it('Should have been added to the index', function(done){
describe("Add (Async)", function(){
flexsearch_async.add(0, "foo");
flexsearch_async.add(2, "bar");
flexsearch_async.add(1, "foobar");
it("Should have been added to the index", function(done){
expect(flexsearch_async.length).to.equal(0);
flexsearch_async.add(0, "foo");
flexsearch_async.add(2, "bar");
flexsearch_async.add(1, "foobar");
setTimeout(function(){
expect(flexsearch_async.length).to.equal(0);
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.index).to.have.keys([0, 1, 2]);
setTimeout(function(){
done();
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.index).to.have.keys([0, 1, 2]);
}, 25);
});
done();
it('Should not have been added to the index', function(done){
}, 25);
});
flexsearch_async.add("foo");
flexsearch_async.add(3);
flexsearch_async.add(null, "foobar");
flexsearch_async.add(void 0, "foobar");
flexsearch_async.add(3, null);
flexsearch_async.add(3, false);
flexsearch_async.add(3, []);
flexsearch_async.add(3, {});
flexsearch_async.add(3, function(){});
it("Should not have been added to the index", function(done){
setTimeout(function(){
flexsearch_async.add("foo");
flexsearch_async.add(3);
flexsearch_async.add(null, "foobar");
flexsearch_async.add(void 0, "foobar");
flexsearch_async.add(3, null);
flexsearch_async.add(3, false);
flexsearch_async.add(3, []);
flexsearch_async.add(3, {});
flexsearch_async.add(3, function(){
});
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.index).to.have.keys([0, 1, 2]);
setTimeout(function(){
done();
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.index).to.have.keys([0, 1, 2]);
}, 25);
done();
}, 25);
});
});
});
describe('Search (Async)', function(){
describe("Search (Async)", function(){
it('Should have been matched from index', function(done){
it("Should have been matched from index", function(done){
flexsearch_async.search("foo", function(result){
flexsearch_async.search("foo", function(result){
expect(result).to.have.members([0, 1]);
});
expect(result).to.have.members([0, 1]);
});
flexsearch_async.search("bar", function(result){
flexsearch_async.search("bar", function(result){
expect(result).to.include(2);
});
expect(result).to.include(2);
});
flexsearch_async.search("foobar", function(result){
flexsearch_async.search("foobar", function(result){
expect(result).to.include(1);
expect(result).to.include(1);
});
setTimeout(function(){
done();
}, 25);
});
setTimeout(function(){
it("Should have been limited", function(done){
done();
flexsearch_async.search("foo", 1, function(result){
}, 25);
});
expect(result).to.include(0);
expect(result).to.not.include(1);
});
it('Should have been limited', function(done){
setTimeout(function(){
flexsearch_async.search("foo", 1, function(result){
done();
expect(result).to.include(0);
expect(result).to.not.include(1);
}, 25);
});
setTimeout(function(){
it("Should not have been matched from index", function(done){
done();
flexsearch_async.search("barfoo", function(result){
}, 25);
});
expect(result).to.have.lengthOf(0);
});
it('Should not have been matched from index', function(done){
flexsearch_async.search("", function(result){
flexsearch_async.search("barfoo", function(result){
expect(result).to.have.lengthOf(0);
});
expect(result).to.have.lengthOf(0);
});
flexsearch_async.search(" ", function(result){
flexsearch_async.search("", function(result){
expect(result).to.have.lengthOf(0);
});
expect(result).to.have.lengthOf(0);
});
flexsearch_async.search(" o ", function(result){
flexsearch_async.search(" ", function(result){
expect(result).to.have.lengthOf(0);
});
expect(result).to.have.lengthOf(0);
});
setTimeout(function(){
flexsearch_async.search(" o ", function(result){
done();
expect(result).to.have.lengthOf(0);
}, 25);
});
setTimeout(function(){
done();
}, 25);
});
});
describe('Update (Async)', function(){
describe("Update (Async)", function(){
it('Should have been updated to the index', function(done){
it("Should have been updated to the index", function(done){
flexsearch_async.update(0, "bar");
flexsearch_async.update(2, "foobar");
flexsearch_async.update(1, "foo");
flexsearch_async.update(0, "bar");
flexsearch_async.update(2, "foobar");
flexsearch_async.update(1, "foo");
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.search("foo")).to.not.have.members([2, 1]);
expect(flexsearch_async.search("bar")).to.not.include(0);
expect(flexsearch_async.search("bar")).to.include(2);
expect(flexsearch_async.search("foobar")).to.not.include(2);
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.search("foo")).to.not.have.members([2, 1]);
expect(flexsearch_async.search("bar")).to.not.include(0);
expect(flexsearch_async.search("bar")).to.include(2);
expect(flexsearch_async.search("foobar")).to.not.include(2);
setTimeout(function(){
setTimeout(function(){
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.search("foo")).to.have.members([2, 1]);
expect(flexsearch_async.search("bar")).to.include(0);
expect(flexsearch_async.search("bar")).to.not.include(2);
expect(flexsearch_async.search("foobar")).to.include(2);
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.search("foo")).to.have.members([2, 1]);
expect(flexsearch_async.search("bar")).to.include(0);
expect(flexsearch_async.search("bar")).to.not.include(2);
expect(flexsearch_async.search("foobar")).to.include(2);
done();
done();
}, 25);
});
}, 25);
});
it('Should not have been updated to the index', function(done){
it("Should not have been updated to the index", function(done){
flexsearch_async.update("foo");
flexsearch_async.update(0);
flexsearch_async.update(null, "foobar");
flexsearch_async.update(void 0, "foobar");
flexsearch_async.update(1, null);
flexsearch_async.update(2, false);
flexsearch_async.update(0, []);
flexsearch_async.update(1, {});
flexsearch_async.update(2, function(){});
flexsearch_async.update("foo");
flexsearch_async.update(0);
flexsearch_async.update(null, "foobar");
flexsearch_async.update(void 0, "foobar");
flexsearch_async.update(1, null);
flexsearch_async.update(2, false);
flexsearch_async.update(0, []);
flexsearch_async.update(1, {});
flexsearch_async.update(2, function(){});
setTimeout(function(){
setTimeout(function(){
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.search("foo")).to.have.members([2, 1]);
expect(flexsearch_async.search("bar")).to.include(0);
expect(flexsearch_async.search("bar")).to.not.include(2);
expect(flexsearch_async.search("foobar")).to.include(2);
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.search("foo")).to.have.members([2, 1]);
expect(flexsearch_async.search("bar")).to.include(0);
expect(flexsearch_async.search("bar")).to.not.include(2);
expect(flexsearch_async.search("foobar")).to.include(2);
done();
done();
}, 25);
}, 25);
});
});
});
describe('Remove (Async)', function(){
describe("Remove (Async)", function(){
it('Should have been removed from the index', function(done){
it("Should have been removed from the index", function(done){
flexsearch_async.remove(0);
flexsearch_async.remove(2);
flexsearch_async.remove(1);
flexsearch_async.remove(0);
flexsearch_async.remove(2);
flexsearch_async.remove(1);
expect(flexsearch_async.length).to.equal(3);
expect(flexsearch_async.length).to.equal(3);
setTimeout(function(){
setTimeout(function(){
expect(flexsearch_async.length).to.equal(0);
expect(flexsearch_async.search("foo")).to.have.lengthOf(0);
expect(flexsearch_async.search("bar")).to.have.lengthOf(0);
expect(flexsearch_async.search("foobar")).to.have.lengthOf(0);
expect(flexsearch_async.length).to.equal(0);
expect(flexsearch_async.search("foo")).to.have.lengthOf(0);
expect(flexsearch_async.search("bar")).to.have.lengthOf(0);
expect(flexsearch_async.search("foobar")).to.have.lengthOf(0);
done();
done();
}, 25);
}, 25);
});
});
});

@@ -604,235 +618,250 @@ // ------------------------------------------------------------------------

describe('Add (Worker)', function(){
describe("Add (Worker)", function(){
it('Should support worker', function(done){
it("Should support worker", function(){
if(typeof Worker === 'undefined'){
if(typeof Worker === "undefined"){
Worker = function(string){};
Worker.prototype.postMessage = function(val){
this.onmessage(val);
};
Worker.prototype.onmessage = function(val){
return val;
};
}
Worker = function(){};
flexsearch_worker = new FlexSearch({
Worker.prototype.postMessage = function(val){
this.onmessage(val);
};
Worker.prototype.onmessage = function(val){
return val;
};
}
encode: 'icase',
mode: 'strict',
async: false,
worker: 4
flexsearch_worker = new FlexSearch({
encode: "icase",
mode: "strict",
async: false,
worker: 4
});
});
done();
});
it("Should have been added to the index", function(done){
it('Should have been added to the index', function(done){
flexsearch_worker.add(0, "foo");
flexsearch_worker.add(2, "bar");
flexsearch_worker.add(1, "foobar");
flexsearch_worker.add(0, "foo");
flexsearch_worker.add(2, "bar");
flexsearch_worker.add(1, "foobar");
expect(flexsearch_worker.length).to.equal(3);
expect(flexsearch_worker.index).to.have.keys([0, 1, 2]);
expect(flexsearch_worker.length).to.equal(3);
expect(flexsearch_worker.index).to.have.keys([0, 1, 2]);
flexsearch_worker.search("foo", function(result){
flexsearch_worker.search("foo", function(result){
expect(result).to.have.length(0);
});
expect(result).to.have.length(0);
setTimeout(function(){
done();
}, 25);
});
setTimeout(function(){
it("Should not have been added to the index", function(done){
done();
flexsearch_worker.add("foo");
flexsearch_worker.add(3);
flexsearch_worker.add(null, "foobar");
flexsearch_worker.add(void 0, "foobar");
flexsearch_worker.add(4, null);
flexsearch_worker.add(5, false);
flexsearch_worker.add(6, []);
flexsearch_worker.add(7, {});
flexsearch_worker.add(8, function(){});
}, 25);
});
setTimeout(function(){
it('Should not have been added to the index', function(done){
expect(flexsearch_worker.length).to.equal(3);
expect(flexsearch_worker.index).to.have.keys([0, 1, 2]);
flexsearch_worker.add("foo");
flexsearch_worker.add(3);
flexsearch_worker.add(null, "foobar");
flexsearch_worker.add(void 0, "foobar");
flexsearch_worker.add(3, null);
flexsearch_worker.add(3, false);
flexsearch_worker.add(3, []);
flexsearch_worker.add(3, {});
flexsearch_worker.add(3, function(){});
done();
setTimeout(function(){
}, 25);
});
});
expect(flexsearch_worker.length).to.equal(3);
expect(flexsearch_worker.index).to.have.keys([0, 1, 2]);
describe("Search (Worker)", function(){
done();
it("Should have been matched from index", function(done){
}, 25);
});
});
flexsearch_worker.search("foo", function(result){
describe('Search (Worker)', function(){
expect(result).to.have.lengthOf(2);
});
it('Should have been matched from index', function(done){
flexsearch_worker.search("bar", function(result){
flexsearch_worker.search("foo", function(result){
expect(result).to.have.lengthOf(2);
});
expect(result).to.have.members([0, 1]);
});
flexsearch_worker.search("foobar", function(result){
flexsearch_worker.search("bar", function(result){
expect(result).to.have.lengthOf(1);
});
expect(result).to.have.members([2, 1]);
});
setTimeout(function(){
flexsearch_worker.search("foobar", function(result){
done();
expect(result).to.have.members([1]);
}, 25);
});
setTimeout(function(){
it("Should have been limited", function(done){
done();
flexsearch_worker.search("foo", 1, function(result){
}, 25);
});
expect(result).to.include(0);
expect(result).to.not.include(1);
});
it('Should have been limited', function(done){
setTimeout(function(){
flexsearch_worker.search("foo", 1, function(result){
done();
expect(result).to.include(0);
expect(result).to.not.include(1);
}, 25);
});
setTimeout(function(){
it("Should not have been matched from index", function(done){
done();
flexsearch_worker.search("barfoo", function(result){
}, 25);
});
expect(result).to.have.lengthOf(0);
});
it('Should not have been matched from index', function(done){
flexsearch_worker.search("", function(result){
flexsearch_worker.search("barfoo", function(result){
expect(result).to.have.lengthOf(0);
});
expect(result).to.have.lengthOf(0);
});
flexsearch_worker.search(" ", function(result){
flexsearch_worker.search("", function(result){
expect(result).to.have.lengthOf(0);
});
expect(result).to.have.lengthOf(0);
});
flexsearch_worker.search(" o ", function(result){
flexsearch_worker.search(" ", function(result){
expect(result).to.have.lengthOf(0);
});
expect(result).to.have.lengthOf(0);
});
setTimeout(function(){
flexsearch_worker.search(" o ", function(result){
done();
expect(result).to.have.lengthOf(0);
}, 25);
});
});
setTimeout(function(){
// TODO:
/*
describe("Update (Worker)", function(){
done();
it("Should have been updated to the index", function(done){
}, 25);
});
});
flexsearch_worker.update(0, "bar");
flexsearch_worker.update(2, "foobar");
flexsearch_worker.update(1, "foo");
describe('Update (Worker)', function(){
setTimeout(function(){
it('Should have been updated to the index', function(done){
expect(flexsearch_worker.length).to.equal(3);
flexsearch_worker.update(0, "bar");
flexsearch_worker.update(2, "foobar");
flexsearch_worker.update(1, "foo");
flexsearch_worker.search("foo", function(results){
expect(flexsearch_worker.length).to.equal(3);
expect(results).to.have.members([2, 1]);
});
flexsearch_worker.search("foo", function(results){
flexsearch_worker.search("bar", function(results){
expect(results).to.have.members([2, 1]);
});
expect(results).to.have.members([0, 2]);
});
flexsearch_worker.search("bar", function(results){
flexsearch_worker.search("foobar", function(results){
expect(results).to.have.members([0, 2]);
});
expect(results).to.have.members([2]);
});
flexsearch_worker.search("foobar", function(results){
setTimeout(function(){
expect(results).to.have.members([2]);
done();
}, 25);
}, 25);
});
});
*/
setTimeout(function(){
describe("Remove (Worker)", function(){
done();
it("Should have been removed from the index", function(done){
}, 50);
});
});
flexsearch_worker.remove(0);
flexsearch_worker.remove(2);
flexsearch_worker.remove(1);
describe('Remove (Worker)', function(){
setTimeout(function(){
it('Should have been removed from the index', function(done){
expect(flexsearch_worker.length).to.equal(0);
flexsearch_worker.remove(0);
flexsearch_worker.remove(2);
flexsearch_worker.remove(1);
flexsearch_worker.search("foo", function(results){
expect(flexsearch_worker.length).to.equal(0);
expect(results).to.not.include(1);
expect(results).to.not.include(2);
});
flexsearch_worker.search("foo", function(results){
flexsearch_worker.search("bar", function(results){
expect(results).to.not.include(1);
expect(results).to.not.include(2);
});
expect(results).to.not.include(0);
expect(results).to.not.include(2);
});
flexsearch_worker.search("bar", function(results){
flexsearch_worker.search("foobar", function(results){
expect(results).to.not.include(0);
expect(results).to.not.include(2);
});
expect(results).to.not.include(2);
});
flexsearch_worker.search("foobar", function(results){
setTimeout(function(){
expect(results).to.not.include(2);
done();
}, 25);
}, 25);
});
setTimeout(function(){
if(env !== "light" && env !== "min"){
done();
it("Should have been debug mode activated", function(){
}, 25);
flexsearch_worker.info();
});
}
});
it('Should have been debug mode activated', function(){
describe("Worker Not Supported", function(){
flexsearch_worker.info();
});
});
it("Should not support worker", function(){
describe('Worker Not Supported', function(){
if(typeof Worker !== "undefined"){
it('Should not support worker', function(){
Worker = void 0;
}
if(typeof Worker !== 'undefined'){
flexsearch_worker = new FlexSearch({
Worker = void 0;
}
encode: false,
async: true,
worker: 4
});
flexsearch_worker = new FlexSearch({
if(env !== "min"){
encode: false,
async: true,
worker: 4
expect(flexsearch_worker.info().worker).to.equal(false);
}
});
expect(flexsearch_worker.info().worker).to.equal(false);
});
});
}

@@ -843,5 +872,5 @@ // ------------------------------------------------------------------------

describe('Encoding', function(){
describe("Encoding", function(){
it('Should have been encoded properly: iCase', function(){
it("Should have been encoded properly: iCase", function(){

@@ -851,27 +880,30 @@ expect(flexsearch_icase.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_icase.encode("björn-phillipp mayer"));

it('Should have been encoded properly: Simple', function(){
if(env !== "light"){
expect(flexsearch_simple.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_simple.encode("bjorn/phillipp mayer"));
});
it("Should have been encoded properly: Simple", function(){
it('Should have been encoded properly: Advanced', function(){
expect(flexsearch_simple.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_simple.encode("bjorn/phillipp mayer"));
});
expect(flexsearch_advanced.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_advanced.encode("bjoern filip mair"));
});
it("Should have been encoded properly: Advanced", function(){
it('Should have been encoded properly: Extra', function(){
expect(flexsearch_advanced.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_advanced.encode("bjoern filip mair"));
});
expect(flexsearch_extra.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_extra.encode("bjorm filib mayr"));
});
it("Should have been encoded properly: Extra", function(){
it('Should have been encoded properly: Custom Encoder', function(){
expect(flexsearch_extra.encode("Björn-Phillipp Mayer")).to.equal(flexsearch_extra.encode("bjorm filib mayr"));
});
}
it("Should have been encoded properly: Custom Encoder", function(){
expect(flexsearch_custom.encode("Björn-Phillipp Mayer")).to.equal("-[BJÖRN-PHILLIPP MAYER]-");
});
it('Should have been encoded properly: Custom Encoder', function(){
it("Should have been encoded properly: Custom Encoder", function(){
FlexSearch.registerEncoder('custom', test_encoder);
FlexSearch.registerEncoder("custom", test_encoder);
expect(FlexSearch.encode('custom', "Björn-Phillipp Mayer")).to.equal(flexsearch_custom.encode("Björn-Phillipp Mayer"));
expect(FlexSearch.encode("custom", "Björn-Phillipp Mayer")).to.equal(flexsearch_custom.encode("Björn-Phillipp Mayer"));
});

@@ -884,10 +916,10 @@ });

describe('Context', function(){
describe("Context", function(){
it('Should have been added properly to the context', function(){
it("Should have been added properly to the context", function(){
var flexsearch_depth = new FlexSearch({
encode: 'icase',
mode: 'strict',
encode: "icase",
mode: "strict",
depth: 2,

@@ -925,5 +957,5 @@ async: false,

describe('Options', function(){
describe("Options", function(){
it('Should have been added properly to the index: Strict', function(){
it("Should have been added properly to the index: Strict", function(){

@@ -937,3 +969,3 @@ flexsearch_strict.add(0, "björn phillipp mayer");

it('Should have been added properly to the index: Forward', function(){
it("Should have been added properly to the index: Forward", function(){

@@ -947,3 +979,3 @@ flexsearch_forward.add(0, "björn phillipp mayer");

it('Should have been added properly to the index: Inverse', function(){
it("Should have been added properly to the index: Inverse", function(){

@@ -953,7 +985,8 @@ flexsearch_reverse.add(0, "björn phillipp mayer");

expect(flexsearch_reverse.length).to.equal(1);
expect(flexsearch_reverse.search("jörn phil yer")).to.have.lengthOf(1);
expect(flexsearch_reverse.search("jörn phil yer")).to.include(0);
expect(flexsearch_reverse.search("jörn phil er")).to.have.lengthOf(1);
expect(flexsearch_reverse.search("jörn lipp er")).to.have.lengthOf(1);
expect(flexsearch_reverse.search("jörn lipp er")).to.include(0);
});
it('Should have been added properly to the index: Full', function(){
it("Should have been added properly to the index: Full", function(){

@@ -967,15 +1000,18 @@ flexsearch_full.add(0, "björn phillipp mayer");

it('Should have been added properly to the index: Full', function(){
if(env !== "light"){
flexsearch_ngram.add(0, "björn-phillipp mayer");
it("Should have been added properly to the index: Full", function(){
expect(flexsearch_ngram.length).to.equal(1);
expect(flexsearch_ngram.search("mayer")).to.have.lengthOf(1);
flexsearch_ngram.add(0, "björn-phillipp mayer");
expect(flexsearch_ngram.search("philip meier")).to.have.lengthOf(1);
expect(flexsearch_ngram.search("philip meier")).to.include(0);
expect(flexsearch_ngram.search("björn meier")).to.have.lengthOf(1);
expect(flexsearch_ngram.search("björn meier")).to.include(0);
expect(flexsearch_ngram.search("björn-peter mayer")).to.have.lengthOf(0);
});
expect(flexsearch_ngram.length).to.equal(1);
expect(flexsearch_ngram.search("mayer")).to.have.lengthOf(1);
expect(flexsearch_ngram.search("philip meier")).to.have.lengthOf(1);
expect(flexsearch_ngram.search("philip meier")).to.include(0);
expect(flexsearch_ngram.search("björn meier")).to.have.lengthOf(1);
expect(flexsearch_ngram.search("björn meier")).to.include(0);
expect(flexsearch_ngram.search("björn-peter mayer")).to.have.lengthOf(0);
});
}
});

@@ -987,9 +1023,9 @@

describe('Relevance', function(){
describe("Relevance", function(){
it('Should have been sorted by relevance properly', function(){
it("Should have been sorted by relevance properly", function(){
var index = new FlexSearch({
encode: 'advanced',
mode: 'strict'
encode: "advanced",
mode: "strict"
});

@@ -1007,4 +1043,4 @@

var index = new FlexSearch({
encode: 'advanced',
mode: 'strict',
encode: "advanced",
mode: "strict",
threshold: 5,

@@ -1024,4 +1060,4 @@ depth: 3

var index = new FlexSearch({
encode: 'extra',
mode: 'ngram',
encode: "extra",
mode: "ngram",
threshold: 5,

@@ -1049,9 +1085,9 @@ depth: 3

describe('Suggestion', function(){
describe("Suggestion", function(){
it('Should have been suggested properly by relevance', function(){
it("Should have been suggested properly by relevance", function(){
var index = new FlexSearch({
encode: 'advanced',
mode: 'strict',
encode: "advanced",
mode: "strict",
suggest: true

@@ -1077,12 +1113,12 @@ });

describe('Add Matchers', function(){
describe("Add Matchers", function(){
it('Should have been added properly', function(){
it("Should have been added properly", function(){
FlexSearch.registerMatcher({
'1': 'a',
'2': 'b',
'3': 'c',
'[456]': 'd'
"1": "a",
"2": "b",
"3": "c",
"[456]": "d"
});

@@ -1096,6 +1132,6 @@

encode: 'not-found',
encode: "not-found",
matcher: {
'7': 'e'
"7": "e"
}

@@ -1105,3 +1141,3 @@

'8': 'f'
"8": "f"

@@ -1120,13 +1156,12 @@ }).add(0, "12345678");

if(env !== 'light'){
if(env !== "light"){
describe('Caching', function(){
describe("Caching", function(){
it('Should have been cached properly', function(){
it("Should have been cached properly", function(){
flexsearch_cache.add(0, 'foo')
.add(1, 'bar')
.add(2, 'foobar');
flexsearch_cache.add(0, "foo")
.add(1, "bar")
.add(2, "foobar");
// fetch:
expect(flexsearch_cache.search("foo")).to.have.members([0, 2]);

@@ -1137,3 +1172,2 @@ expect(flexsearch_cache.search("bar")).to.have.members([1, 2]);

// cache:
expect(flexsearch_cache.search("foo")).to.have.members([0, 2]);

@@ -1144,7 +1178,5 @@ expect(flexsearch_cache.search("bar")).to.have.members([1, 2]);

// update:
flexsearch_cache.remove(2).update(1, "foo").add(3, "foobar");
flexsearch_cache.remove(2).update(1, 'foo').add(3, 'foobar');
// fetch:
expect(flexsearch_cache.search("foo")).to.have.members([0, 1, 3]);

@@ -1155,3 +1187,2 @@ expect(flexsearch_cache.search("bar")).to.include(3);

// cache:
expect(flexsearch_cache.search("foo")).to.have.members([0, 1, 3]);

@@ -1168,7 +1199,7 @@ expect(flexsearch_cache.search("bar")).to.include(3);

if(env !== 'light'){
if(env !== "light" && env !== "min"){
describe('Debug', function(){
describe("Debug", function(){
it('Should have been debug mode activated', function(){
it("Should have been debug mode activated", function(){

@@ -1179,11 +1210,11 @@ var info = flexsearch_cache.info();

'id',
'chars',
'status',
'cache',
'items',
'matcher',
'memory',
'sequences',
'worker'
"id",
"chars",
//"status",
"cache",
"items",
"matcher",
"memory",
"sequences",
"worker"
]);

@@ -1198,10 +1229,10 @@ });

describe('Chaining', function(){
describe("Chaining", function(){
it('Should have been chained properly', function(){
it("Should have been chained properly", function(){
var index = FlexSearch.create({mode: 'forward', encode: 'icase'})
.addMatcher({'â': 'a'})
.add(0, 'foo')
.add(1, 'bar');
var index = FlexSearch.create({mode: "forward", encode: "icase"})
.addMatcher({"â": "a"})
.add(0, "foo")
.add(1, "bar");

@@ -1212,3 +1243,3 @@ expect(index.search("foo")).to.include(0);

index.remove(0).update(1, 'foo').add(2, 'foobâr');
index.remove(0).update(1, "foo").add(2, "foobâr");

@@ -1219,3 +1250,3 @@ expect(index.search("foo")).to.have.members([1, 2]);

index.reset().add(0, 'foo').add(1, 'bar');
index.clear().add(0, "foo").add(1, "bar");

@@ -1226,3 +1257,3 @@ expect(index.search("foo")).to.include(0);

flexsearch_cache.destroy().init().add(0, 'foo').add(1, 'bar');
flexsearch_cache.destroy().init().add(0, "foo").add(1, "bar");

@@ -1239,3 +1270,3 @@ expect(flexsearch_cache.search("foo")).to.include(0);

return '-[' + str.toUpperCase() + ']-';
return "-[" + str.toUpperCase() + "]-";
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc