1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-02 02:12:46 +02:00

FIX test and missing log folder

This commit is contained in:
Thomas Wilkerling
2018-04-12 08:01:12 +02:00
parent d51a66d3d6
commit 8abbed8473
7 changed files with 23 additions and 30 deletions

View File

@@ -1,4 +1,3 @@
<p align="center"></p>
<p align="center">
<br>
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/flexsearch.svg" alt="Search Library" width="50%">
@@ -7,10 +6,10 @@
<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 href="https://app.fossa.io/projects/git%2Bgithub.com%2Fts-thomas%2Fflexsearch?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fts-thomas%2Fflexsearch.svg?type=shield"/></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>
@@ -29,14 +28,6 @@ Supported Platforms:
- Browser
- Node.js
<!--
Supported Module Definitions:
- AMD (RequireJS)
- CommonJS (Node.js)
- Closure (Xone)
- Global (Browser)
-->
All Features:
<ul>
<li><a href="#webworker">Web-Worker Sharding</a> (not available in Node.js)</li>
@@ -66,8 +57,6 @@ The light version is just available as compiled version (<a href="flexsearch.lig
<a name="contextual"></a>
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fts-thomas%2Fflexsearch.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fts-thomas%2Fflexsearch?ref=badge_large)
#### 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>.
@@ -1218,4 +1207,4 @@ The custom build was saved to flexsearch.custom.js
---
Copyright 2018 Thomas Wilkerling<br>
Released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 License</a><br>
Released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 License</a><br>

View File

@@ -1,4 +1,5 @@
var child_process = require('child_process');
var fs = require('fs');
var supported_lang = [
@@ -8,6 +9,8 @@ var supported_lang = [
console.log("Start build .....");
fs.existsSync("log") || fs.mkdirSync("log");
var options = (function(argv){
var arr = {};

View File

@@ -1,5 +1,5 @@
;/**!
* @preserve FlexSearch v0.2.49
* @preserve FlexSearch v0.2.63
* Copyright 2018 Thomas Wilkerling
* Released under the Apache 2.0 Licence
* https://github.com/nextapps-de/flexsearch

View File

@@ -1,5 +1,5 @@
/*
FlexSearch v0.2.49
FlexSearch v0.2.63
Copyright 2018 Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
@@ -7,13 +7,13 @@
'use strict';(function(d,v,n){var t;(t=n.define)&&t.amd?t([],function(){return v}):(t=n.modules)?t[d.toLowerCase()]=v:"undefined"!==typeof module?module.exports=v:n[d]=v})("FlexSearch",function(){function d(a){"string"===typeof a&&(a=B[a]);a||(a=x);this.id=a.id||G++;this.init(a);v(this,"index",function(){return this.a});v(this,"length",function(){return Object.keys(this.a).length})}function v(a,b,c){Object.defineProperty(a,b,{get:c})}function n(a){return new RegExp(a,"g")}function t(a,b,c){if("undefined"===
typeof c){for(c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}return a.replace(b,c)}function z(a,b,c,e,f,p,g){if("undefined"===typeof b[c]){var h=f?(9-(g||6))*p+(g||6)*f:p;b[c]=h;h>=g&&(a=a[h+.5|0],a=a[c]||(a[c]=[]),a[a.length]=e)}return h||b[c]}function A(a,b){if(a)for(var c=Object.keys(a),e=0,f=c.length;e<f;e++){var p=c[e],g=a[p];if(g)for(var h=0,k=g.length;h<k;h++)if(g[h]===b){1===k?delete a[p]:g.splice(h,1);break}else"object"===typeof g[h]&&A(g[h],b)}}function C(a){var b=[];if(!a)return b;
for(var c=0,e=0,f=0,p="",g=a.length,h=0;h<g;h++){var k=a[h];"a"===k||"e"===k||"i"===k||"o"===k||"u"===k||"y"===k?c++:e++;" "!==k&&(p+=k);if(" "===k||c>=(8<g?2:1)&&2<=e||2<=c&&e>=(8<g?2:1)||h===g-1)p&&(b[f]&&2<p.length&&f++,b[f]=b[f]?b[f]+p:p," "===k&&f++,p=""),e=c=0}return b}function H(a,b){a=a.length-b.length;return 0>a?1:0<a?-1:0}function I(a,b){a=a.length-b.length;return 0>a?-1:0<a?1:0}function J(a,b,c){var e=[],f=[],p=a.length;if(1<p){a.sort(I);for(var g={},h=a[0],k=h.length,y=0;y<k;)g[h[y++]]=
1;for(var q,d=0,m=1;m<p;){var l=!1,n=m===p-1;f=[];h=a[m];k=h.length;for(y=-1;y<k;){var r=g[q=h[++y]];if(r===m){if(n&&(e[d++]=q,b&&d===b))return e;l=!0;g[q]=m+1}else c&&(r=f[r]||(f[r]=[]),r[r.length]=q)}if(!l&&!c)break;m++}if(c&&(b||(b=1E3),d=e.length,k=f.length,d<b&&k))for(m=k-1;0<=m;m--)if(q=f[m])for(y=0;y<q.length;y++)if(e[d++]=q[y],b&&d===b)return e}else p&&(e=a[0],b&&e.length>b&&(e=e.slice(0,b)));return e}var x={encode:"icase",mode:"ngram",f:!1,cache:!1,async:!1,j:!1,threshold:0,depth:0},B={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}},w=[],G=0,D=n("[ -/]"),E={},F={};d.new=function(a){return new this(a)};d.create=function(a){return d.new(a)};d.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&(w[w.length]=n(b),w[w.length]=a[b]);
return this};d.registerEncoder=function(a,b){u[a]=b;return this};d.registerLanguage=function(a,b){E[a]=b.filter;F[a]=b.stemmer;return this};d.encode=function(a,b){return u[a].call(u,b)};d.prototype.init=function(a){this.i=[];a||(a=x);var b=a.profile;b=b?B[b]:{};this.mode=a.mode||b.mode||this.mode||x.mode;this.threshold=a.threshold||b.threshold||this.threshold||x.threshold;this.depth=a.depth||b.depth||this.depth||x.depth;this.f=a.suggest||this.f||x.f;this.c=(b=a.encode||b.encode)&&u[b]||("function"===
typeof b?b:this.c||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){b=E[b]||b;var c=this.c,e={};if(b)for(var f=0;f<b.length;f++){var p=c?c.call(u,b[f]):b[f];e[p]=String.fromCharCode(65E3-b.length+f)}this.filter=e}if(b=a.stemmer){a=F[b]||b;b=this.c;c=[];if(a){e=0;for(var g in a)a.hasOwnProperty(g)&&(f=b?b.call(u,g):g,c[e++]=n("(?=.{"+(f.length+3)+",})"+f+"$"),c[e++]=b?b.call(u,a[g]):a[g])}this.stemmer=c}this.g=[{},{},{},{},{},{},{},{},{},{}];this.b={};this.a={};this.h=!0;return this};d.prototype.encode=
function(a){a&&w.length&&(a=t(a,w));a&&this.i.length&&(a=t(a,this.i));a&&this.c&&(a=this.c.call(u,a));a&&this.stemmer&&(a=t(a,this.stemmer));return a};d.prototype.addMatcher=function(a){var b=this.i,c;for(c in a)a.hasOwnProperty(c)&&(b[b.length]=n(c),b[b.length]=a[c]);return this};d.prototype.add=function(a,b,c){if("string"===typeof b&&b&&(a||0===a))if(this.a[a]&&!c)this.update(a,b);else{b=this.encode(b);if(!b.length)return this;c=this.mode;b="function"===typeof c?c(b):"ngram"===c?C(b):b.split(D);
for(var e={_ctx:{}},f=this.threshold,p=this.depth,g=this.g,h=b.length,k=0;k<h;k++){var d=b[k];if(d){var q=d.length,n=(h-k)/h;switch(c){case "reverse":case "both":for(var m="",l=q-1;1<=l;l--)m=d[l]+m,z(g,e,m,a,(q-l)/q,n,f);case "forward":m="";for(l=0;l<q;l++)m+=d[l],z(g,e,m,a,1,n,f);break;case "full":for(l=0;l<q;l++)for(var t=(q-l)/q,r=q;r>l;r--)m=d.substring(l,r),z(g,e,m,a,t,n,f);break;default:if(l=z(g,e,d,a,1,n,f),p&&1<h&&l>=f)for(q=e._ctx[d]||(e._ctx[d]={}),d=this.b[d]||(this.b[d]=[{},{},{},{},
{},{},{},{},{},{}]),l=k-p,r=k+p+1,0>l&&(l=0),r>h&&(r=h);l<r;l++)l!==k&&z(d,q,b[l],a,0,10-(l<k?k-l:l-k),f)}}}this.a[a]="1";this.h=!1}return this};d.prototype.update=function(a,b){this.a[a]&&b&&"string"===typeof b&&(this.remove(a),this.add(a,b,!0));return this};d.prototype.remove=function(a){if(this.a[a]){for(var b=0;10>b;b++)A(this.g[b],a);this.depth&&A(this.b,a);delete this.a[a];this.h=!1}return this};d.prototype.search=function(a,b,c){var e=[];if(a&&"object"===typeof a){c=a.callback||b;b=a.limit;
var f=a.threshold;a=a.query}f=(f||this.threshold||0)|0;"function"===typeof b?(c=b,b=1E3):b||(b=1E3);if(c){var d=this;K(function(){c(d.search(a,b));d=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return e;this.h||(this.h=!0);var g=this.encode(a);if(!g.length)return e;var h=this.mode;g="function"===typeof h?h(g):"ngram"===h?C(g):g.split(D);h=g.length;var k=!0,n=[],q={};if(1<h)if(this.depth){var t=!0,m=g[0];q[m]="1"}else g.sort(H);var l;if(!t||(l=this.b)[m])for(var u=t?1:0;u<h;u++){var r=
g[u];if(r&&!q[r]){for(var v,x=!1,w=[],z=0,A=9;A>=f;A--)if(v=(t?l[m]:this.g)[A][r])w[z++]=v,x=!0;if(x)n[n.length]=1<z?n.concat.apply([],w):w[0];else if(!this.f){k=!1;break}q[r]="1"}m=r}else k=!1;k&&(e=J(n,b,this.f));return e};d.prototype.reset=function(){this.destroy();return this.init()};d.prototype.destroy=function(){this.filter=this.stemmer=this.g=this.b=this.a=null;return this};var u={icase:function(a){return a.toLowerCase()},balance:function(){var a=[n("[-/]")," ",n("[^a-z0-9 ]"),"",n("\\s\\s+"),
" "];return function(b){b=t(b.toLowerCase(),a);for(var c="",e="",f="",d=0;d<b.length;d++){var g=b[d];if(g!==e)if(d&&"h"===g){if(f="a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f,("a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e)&&f||" "===e)c+=g}else c+=g;f=d===b.length-1?"":b[d+1];e=g}return c}}()},K=null;return d}(!1),this);
1;for(var q,d=0,m=1;m<p;){var l=!1,n=m===p-1;f=[];h=a[m];k=h.length;for(y=-1;y<k;){var r=g[q=h[++y]];if(r===m){if(n&&(e[d++]=q,b&&d===b))return e;l=!0;g[q]=m+1}else c&&(r=f[r]||(f[r]=[]),r[r.length]=q)}if(!l&&!c)break;m++}if(c&&(b||(b=1E3),d=e.length,k=f.length,d<b&&k))for(m=k-1;0<=m;m--)if(q=f[m])for(y=0;y<q.length;y++)if(e[d++]=q[y],b&&d===b)return e}else p&&(e=a[0],b&&e.length>b&&(e=e.slice(0,b)));return e}var x={encode:"icase",mode:"forward",f:!1,cache:!1,async:!1,j:!1,threshold:0,depth:0},B=
{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}},w=[],G=0,D=n("[ -/]"),E={},F={};d.new=function(a){return new this(a)};d.create=function(a){return d.new(a)};d.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&(w[w.length]=
n(b),w[w.length]=a[b]);return this};d.registerEncoder=function(a,b){u[a]=b;return this};d.registerLanguage=function(a,b){E[a]=b.filter;F[a]=b.stemmer;return this};d.encode=function(a,b){return u[a].call(u,b)};d.prototype.init=function(a){this.i=[];a||(a=x);var b=a.profile;b=b?B[b]:{};this.mode=a.mode||b.mode||this.mode||x.mode;this.threshold=a.threshold||b.threshold||this.threshold||x.threshold;this.depth=a.depth||b.depth||this.depth||x.depth;this.f=a.suggest||this.f||x.f;this.c=(b=a.encode||b.encode)&&
u[b]||("function"===typeof b?b:this.c||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){b=E[b]||b;var c=this.c,e={};if(b)for(var f=0;f<b.length;f++){var p=c?c.call(u,b[f]):b[f];e[p]=String.fromCharCode(65E3-b.length+f)}this.filter=e}if(b=a.stemmer){a=F[b]||b;b=this.c;c=[];if(a){e=0;for(var g in a)a.hasOwnProperty(g)&&(f=b?b.call(u,g):g,c[e++]=n("(?=.{"+(f.length+3)+",})"+f+"$"),c[e++]=b?b.call(u,a[g]):a[g])}this.stemmer=c}this.g=[{},{},{},{},{},{},{},{},{},{}];this.b={};this.a={};this.h=!0;return this};
d.prototype.encode=function(a){a&&w.length&&(a=t(a,w));a&&this.i.length&&(a=t(a,this.i));a&&this.c&&(a=this.c.call(u,a));a&&this.stemmer&&(a=t(a,this.stemmer));return a};d.prototype.addMatcher=function(a){var b=this.i,c;for(c in a)a.hasOwnProperty(c)&&(b[b.length]=n(c),b[b.length]=a[c]);return this};d.prototype.add=function(a,b,c){if("string"===typeof b&&b&&(a||0===a))if(this.a[a]&&!c)this.update(a,b);else{b=this.encode(b);if(!b.length)return this;c=this.mode;b="function"===typeof c?c(b):"ngram"===
c?C(b):b.split(D);for(var e={_ctx:{}},f=this.threshold,p=this.depth,g=this.g,h=b.length,k=0;k<h;k++){var d=b[k];if(d){var q=d.length,n=(h-k)/h;switch(c){case "reverse":case "both":for(var m="",l=q-1;1<=l;l--)m=d[l]+m,z(g,e,m,a,(q-l)/q,n,f);case "forward":m="";for(l=0;l<q;l++)m+=d[l],z(g,e,m,a,1,n,f);break;case "full":for(l=0;l<q;l++)for(var t=(q-l)/q,r=q;r>l;r--)m=d.substring(l,r),z(g,e,m,a,t,n,f);break;default:if(l=z(g,e,d,a,1,n,f),p&&1<h&&l>=f)for(q=e._ctx[d]||(e._ctx[d]={}),d=this.b[d]||(this.b[d]=
[{},{},{},{},{},{},{},{},{},{}]),l=k-p,r=k+p+1,0>l&&(l=0),r>h&&(r=h);l<r;l++)l!==k&&z(d,q,b[l],a,0,10-(l<k?k-l:l-k),f)}}}this.a[a]="1";this.h=!1}return this};d.prototype.update=function(a,b){this.a[a]&&b&&"string"===typeof b&&(this.remove(a),this.add(a,b,!0));return this};d.prototype.remove=function(a){if(this.a[a]){for(var b=0;10>b;b++)A(this.g[b],a);this.depth&&A(this.b,a);delete this.a[a];this.h=!1}return this};d.prototype.search=function(a,b,c){var e=[];if(a&&"object"===typeof a){c=a.callback||
b;b=a.limit;var f=a.threshold;a=a.query}f=(f||this.threshold||0)|0;"function"===typeof b?(c=b,b=1E3):b||(b=1E3);if(c){var d=this;K(function(){c(d.search(a,b));d=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return e;this.h||(this.h=!0);var g=this.encode(a);if(!g.length)return e;var h=this.mode;g="function"===typeof h?h(g):"ngram"===h?C(g):g.split(D);h=g.length;var k=!0,n=[],q={};if(1<h)if(this.depth){var t=!0,m=g[0];q[m]="1"}else g.sort(H);var l;if(!t||(l=this.b)[m])for(var u=
t?1:0;u<h;u++){var r=g[u];if(r&&!q[r]){for(var v,x=!1,w=[],z=0,A=9;A>=f;A--)if(v=(t?l[m]:this.g)[A][r])w[z++]=v,x=!0;if(x)n[n.length]=1<z?n.concat.apply([],w):w[0];else if(!this.f){k=!1;break}q[r]="1"}m=r}else k=!1;k&&(e=J(n,b,this.f));return e};d.prototype.reset=function(){this.destroy();return this.init()};d.prototype.destroy=function(){this.filter=this.stemmer=this.g=this.b=this.a=null;return this};var u={icase:function(a){return a.toLowerCase()},balance:function(){var a=[n("[-/]")," ",n("[^a-z0-9 ]"),
"",n("\\s\\s+")," "];return function(b){b=t(b.toLowerCase(),a);for(var c="",e="",f="",d=0;d<b.length;d++){var g=b[d];if(g!==e)if(d&&"h"===g){if(f="a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f,("a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e)&&f||" "===e)c+=g}else c+=g;f=d===b.length-1?"":b[d+1];e=g}return c}}()},K=null;return d}(!1),this);

4
flexsearch.min.js vendored
View File

@@ -1,5 +1,5 @@
/*
FlexSearch v0.2.49
FlexSearch v0.2.63
Copyright 2018 Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
@@ -11,7 +11,7 @@ d;c=k===a.length-1?"":a[k+1];e=d}return b}function P(a,b){var e={};if(a)for(var
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.B||
(a.B=I(function(){a.B=null;var b=a.async;b&&(a.async=!1);if(a.b.length){for(var e=J(),c;(c=a.b.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])}a.f[c]=null;delete a.f[c];if(100<J()-e)break}a.b.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.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.reset?b.reset():c.info?(c=b.info(),c.worker=a,b.debug&&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",v:!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",
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:"forward",v:!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.A=[];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.h=null;else{var c=this;b=parseInt(b,10)||4;c.m=-1;c.s=0;c.g=[];c.w=null;c.h=Array(b);for(var d=0;d<b;d++)c.h[d]=U(c.id,d,a||x,function(a,b,e,d){c.s!==c.c&&(c.g=c.g.concat(e),c.s++,d&&c.g.length>=d&&(c.s=c.c),c.w&&c.s===c.c&&(c.cache&&c.i.set(b,c.g),c.w(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.v=a.suggest||this.v||x.v;this.u=(b=a.encode||e.encode)&&A[b]||("function"===typeof b?b:this.u||!1);this.debug=a.debug||this.debug;(b=a.matcher)&&this.addMatcher(b);if(b=a.filter)this.filter=P(L[b]||b,this.u);if(b=a.stemmer)this.stemmer=Q(M[b]||b,this.u);this.j=[{},{},{},{},{},{},{},{},{},{}];this.l={};this.a={};this.f={};this.b=[];this.B=null;this.o=

View File

@@ -1,6 +1,6 @@
{
"name": "flexsearch",
"version": "0.2.52",
"version": "0.2.63",
"description": "Next-Generation full text search library with zero dependencies.",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",
@@ -46,12 +46,13 @@
"README.md",
"LICENSE"
],
"readme": "README.md",
"dependencies": {},
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"google-closure-compiler": "^20180402.0.0",
"mocha": "^5.0.4",
"mocha": "^5.0.5",
"mocha-lcov-reporter": "^1.3.0",
"mocha-phantomjs": "^4.1.0",
"nyc": "^11.6.0",

View File

@@ -171,7 +171,7 @@ describe('Initialize', function(){
it('Should have the correct options', function(){
expect(flexsearch_default.async).to.equal(false);
expect(flexsearch_default.mode).to.equal("ngram");
expect(flexsearch_default.mode).to.equal("forward");
expect(flexsearch_sync.async).to.equal(false);
expect(flexsearch_async.async).to.equal(true);
expect(flexsearch_strict.mode).to.equal("strict");