Skip to content

Commit 784c37f

Browse files
committed
v0.3.2
1 parent e66e98c commit 784c37f

File tree

11 files changed

+165
-134
lines changed

11 files changed

+165
-134
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ All Features:
170170
<td>File Size (gzip)</td>
171171
<td>6.7 kb</td>
172172
<td>4.5 kb</td>
173-
<td>2.1 kb</td>
173+
<td>4.1 kb</td>
174174
</tr>
175175
</table>
176176

@@ -197,9 +197,9 @@ __Query Test: "Gulliver's Travels"__
197197
<tr>
198198
<td>1</td>
199199
<td>FlexSearch</td>
200-
<td>0.3.1</td>
201-
<td>2.1 kb</td>
202-
<td><b>327771</b></td>
200+
<td>0.3.2</td>
201+
<td>4.1 kb</td>
202+
<td><b>333738</b></td>
203203
</tr>
204204
<tr></tr>
205205
<tr>
@@ -418,7 +418,7 @@ __Note:__ It is slightly faster to use no web worker when the index or query isn
418418
<tr>
419419
<td>Weaks</td>
420420
<td><ul><li>less powerful contextual search</li><li>less memory efficient (has to be defragmented from time to time)</li></ul></td>
421-
<td><ul><li>updating / deleting extisting items from index is slow</li><li>adding items to the index optimized for super partial matching (mode: "full") is slow</li></ul></td>
421+
<td><ul><li>updating / deleting extisting items from index is slow</li><li>adding items to the index optimized for super partial matching (tokenize: "full") is slow</li></ul></td>
422422
</tr>
423423
<tr></tr>
424424
<tr>
@@ -563,7 +563,7 @@ var index = new FlexSearch({
563563

564564
profile: "balance",
565565
encode: "icase",
566-
mode: "ngram",
566+
tokenize: "ngram",
567567
async: false,
568568
cache: false
569569
});
@@ -810,7 +810,7 @@ Define a private custom tokenizer during creation/initialization:
810810
```js
811811
var index = new FlexSearch({
812812

813-
mode: function(str){
813+
tokenize: function(str){
814814

815815
// split string into components, e.g.:
816816

@@ -930,7 +930,7 @@ Create index and just set the limit of relevance ("depth"):
930930
var index = new FlexSearch({
931931

932932
encode: "icase",
933-
mode: "strict",
933+
tokenize: "strict",
934934
depth: 3
935935
});
936936
```
@@ -954,7 +954,7 @@ Create index and just set the count of parallel threads:
954954
var index = new FlexSearch({
955955

956956
encode: "icase",
957-
mode: "full",
957+
tokenize: "full",
958958
async: true,
959959
worker: 4
960960
});
@@ -1001,7 +1001,7 @@ FlexSearch ist highly customizable. Make use of the the <a href="#profiles">righ
10011001
</tr>
10021002
<tr></tr>
10031003
<tr>
1004-
<td align="top">mode<br><br><br><br><br><br></td>
1004+
<td align="top">tokenize<br><br><br><br><br><br></td>
10051005
<td vertical="top" vertical-align="top">
10061006
"strict"<br>
10071007
"foward"<br>
@@ -1422,15 +1422,15 @@ Standard profile: __"default"__
14221422
```js
14231423
{
14241424
encode: "icase",
1425-
mode: "forward"
1425+
tokenize: "forward"
14261426
}
14271427
```
14281428

14291429
Memory-optimized profile: __"memory"__
14301430
```js
14311431
{
14321432
encode: "extra",
1433-
mode: "strict",
1433+
tokenize: "strict",
14341434
threshold: 7
14351435
}
14361436
```
@@ -1440,7 +1440,7 @@ Speed-optimized profile: __"speed"__
14401440
```js
14411441
{
14421442
encode: "icase",
1443-
mode: "strict",
1443+
tokenize: "strict",
14441444
threshold: 7,
14451445
depth: 2
14461446
}
@@ -1451,7 +1451,7 @@ Matching-tolerant profile: __"match"__
14511451
```js
14521452
{
14531453
encode: "extra",
1454-
mode: "full"
1454+
tokenize: "full"
14551455
}
14561456
```
14571457

@@ -1460,7 +1460,7 @@ Relevance-optimized profile: __"score"__
14601460
```js
14611461
{
14621462
encode: "extra",
1463-
mode: "strict",
1463+
tokenize: "strict",
14641464
threshold: 5,
14651465
depth: 5
14661466
}
@@ -1471,7 +1471,7 @@ Most-balanced profile: __"balanced"__
14711471
```js
14721472
{
14731473
encode: "balanced",
1474-
mode: "ngram",
1474+
tokenize: "ngram",
14751475
threshold: 6,
14761476
depth: 3
14771477
}

compile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var parameter = (function(opt){
7171
generate_exports: true,
7272
export_local_property_definitions: true,
7373
language_in: "ECMASCRIPT6_STRICT",
74-
language_out: language_out || "ECMASCRIPT5_STRICT",
74+
language_out: language_out || "ECMASCRIPT6_STRICT",
7575
process_closure_primitives: true,
7676
summary_detail_level: 3,
7777
warning_level: "VERBOSE",
@@ -118,12 +118,12 @@ else{
118118

119119
console.log("Build Complete: " + filename);
120120

121-
if(release === "demo"){
121+
if(release === "es5"){
122122

123123
//fs.existsSync("dist/") || fs.mkdirSync("dist/");
124124
//fs.existsSync("dist/latest") || fs.mkdirSync("dist/latest");
125125

126-
fs.copyFileSync(filename, "docs/" + filename);
126+
fs.copyFileSync(filename, "test/" + filename);
127127
//fs.copyFileSync(filename, "dist/latest/" + filename);
128128
fs.unlinkSync(filename);
129129
}

flexsearch.compact.js

Lines changed: 18 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flexsearch.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
;/**!
2-
* @preserve FlexSearch v0.3.1
2+
* @preserve FlexSearch v0.3.2
33
* Copyright 2019 Nextapps GmbH
44
* Author: Thomas Wilkerling
55
* Released under the Apache 2.0 Licence
@@ -31,7 +31,7 @@
3131
const defaults = {
3232

3333
encode: "icase",
34-
mode: "forward",
34+
tokenize: "forward",
3535
suggest: false,
3636
cache: false,
3737
async: false,
@@ -53,39 +53,39 @@
5353

5454
"memory": {
5555
encode: SUPPORT_ENCODER ? "extra" : "icase",
56-
mode: "strict",
56+
tokenize: "strict",
5757
threshold: 7
5858
},
5959

6060
"speed": {
6161
encode: "icase",
62-
mode: "strict",
62+
tokenize: "strict",
6363
threshold: 7,
6464
depth: 2
6565
},
6666

6767
"match": {
6868
encode: SUPPORT_ENCODER ? "extra" : "icase",
69-
mode: "full"
69+
tokenize: "full"
7070
},
7171

7272
"score": {
7373
encode: SUPPORT_ENCODER ? "extra" : "icase",
74-
mode: "strict",
74+
tokenize: "strict",
7575
threshold: 5,
7676
depth: 4
7777
},
7878

7979
"balance": {
8080
encode: SUPPORT_ENCODER ? "balance" : "icase",
81-
mode: "strict",
81+
tokenize: "strict",
8282
threshold: 6,
8383
depth: 3
8484
},
8585

8686
"fastest": {
8787
encode: "icase",
88-
mode: "strict",
88+
tokenize: "strict",
8989
threshold: 9,
9090
depth: 1
9191
}
@@ -361,12 +361,12 @@
361361
// apply custom options
362362

363363
/** @private */
364-
this.mode = (
364+
this.tokenize = (
365365

366-
options["mode"] ||
367-
profile.mode ||
368-
this.mode ||
369-
defaults.mode
366+
options["tokenize"] ||
367+
profile.tokenize ||
368+
this.tokenize ||
369+
defaults.tokenize
370370
);
371371

372372
if(SUPPORT_ASYNC) /** @private */ this.async = (
@@ -674,7 +674,7 @@
674674
return this;
675675
}
676676

677-
const tokenizer = this.mode;
677+
const tokenizer = this.tokenize;
678678

679679
const words = (
680680

@@ -1046,7 +1046,7 @@
10461046

10471047
return;
10481048
}
1049-
else if(SUPPORT_ASYNC && !_recall && this.async){
1049+
else if(SUPPORT_ASYNC && !_recall && this.async && (typeof importScripts !== "function")){
10501050

10511051
/** @type {FlexSearch} */
10521052
let self = this;
@@ -1105,7 +1105,7 @@
11051105

11061106
// convert words into single components
11071107

1108-
const tokenizer = this.mode;
1108+
const tokenizer = this.tokenize;
11091109

11101110
const words = (
11111111

@@ -1136,7 +1136,7 @@
11361136
if(this.depth){
11371137

11381138
use_contextual = true;
1139-
// TODO: alternative roots
1139+
// TODO: iterate roots
11401140
ctx_root = words[0];
11411141
check_words[ctx_root] = 1;
11421142
}
@@ -1302,10 +1302,12 @@
13021302
"items": items,
13031303
"sequences": words,
13041304
"chars": chars,
1305-
//"status": this._cache_status,
1306-
"cache": this._stack_keys.length,
1307-
"matcher": global_matcher.length,
1308-
"worker": this.worker
1305+
"cache": this.cache && this.cache.ids ? this.cache.ids.length : false,
1306+
"matcher": global_matcher.length + (this._matcher ? this._matcher.length : 0),
1307+
"worker": this.worker,
1308+
"threshold": this.threshold,
1309+
"depth": this.depth,
1310+
"contextual": !!this.depth
13091311
};
13101312
};
13111313
}
@@ -2818,7 +2820,7 @@
28182820
:
28192821
// Load Extern Worker (but also requires CORS)
28202822

2821-
"../" + name + (RELEASE ? "." + RELEASE : "") + ".js"
2823+
name + (RELEASE ? "." + RELEASE : "") + ".js"
28222824
);
28232825

28242826
name += "-" + _id;

flexsearch.light.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)