Skip to content

Commit

Permalink
v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ts-thomas committed Jan 28, 2019
1 parent e66e98c commit 784c37f
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 134 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ All Features:
<td>File Size (gzip)</td>
<td>6.7 kb</td>
<td>4.5 kb</td>
<td>2.1 kb</td>
<td>4.1 kb</td>
</tr>
</table>

Expand All @@ -197,9 +197,9 @@ __Query Test: "Gulliver's Travels"__
<tr>
<td>1</td>
<td>FlexSearch</td>
<td>0.3.1</td>
<td>2.1 kb</td>
<td><b>327771</b></td>
<td>0.3.2</td>
<td>4.1 kb</td>
<td><b>333738</b></td>
</tr>
<tr></tr>
<tr>
Expand Down Expand Up @@ -418,7 +418,7 @@ __Note:__ It is slightly faster to use no web worker when the index or query isn
<tr>
<td>Weaks</td>
<td><ul><li>less powerful contextual search</li><li>less memory efficient (has to be defragmented from time to time)</li></ul></td>
<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>
<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>
</tr>
<tr></tr>
<tr>
Expand Down Expand Up @@ -563,7 +563,7 @@ var index = new FlexSearch({

profile: "balance",
encode: "icase",
mode: "ngram",
tokenize: "ngram",
async: false,
cache: false
});
Expand Down Expand Up @@ -810,7 +810,7 @@ Define a private custom tokenizer during creation/initialization:
```js
var index = new FlexSearch({

mode: function(str){
tokenize: function(str){

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

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

encode: "icase",
mode: "strict",
tokenize: "strict",
depth: 3
});
```
Expand All @@ -954,7 +954,7 @@ Create index and just set the count of parallel threads:
var index = new FlexSearch({

encode: "icase",
mode: "full",
tokenize: "full",
async: true,
worker: 4
});
Expand Down Expand Up @@ -1001,7 +1001,7 @@ FlexSearch ist highly customizable. Make use of the the <a href="#profiles">righ
</tr>
<tr></tr>
<tr>
<td align="top">mode<br><br><br><br><br><br></td>
<td align="top">tokenize<br><br><br><br><br><br></td>
<td vertical="top" vertical-align="top">
"strict"<br>
"foward"<br>
Expand Down Expand Up @@ -1422,15 +1422,15 @@ Standard profile: __"default"__
```js
{
encode: "icase",
mode: "forward"
tokenize: "forward"
}
```

Memory-optimized profile: __"memory"__
```js
{
encode: "extra",
mode: "strict",
tokenize: "strict",
threshold: 7
}
```
Expand All @@ -1440,7 +1440,7 @@ Speed-optimized profile: __"speed"__
```js
{
encode: "icase",
mode: "strict",
tokenize: "strict",
threshold: 7,
depth: 2
}
Expand All @@ -1451,7 +1451,7 @@ Matching-tolerant profile: __"match"__
```js
{
encode: "extra",
mode: "full"
tokenize: "full"
}
```

Expand All @@ -1460,7 +1460,7 @@ Relevance-optimized profile: __"score"__
```js
{
encode: "extra",
mode: "strict",
tokenize: "strict",
threshold: 5,
depth: 5
}
Expand All @@ -1471,7 +1471,7 @@ Most-balanced profile: __"balanced"__
```js
{
encode: "balanced",
mode: "ngram",
tokenize: "ngram",
threshold: 6,
depth: 3
}
Expand Down
6 changes: 3 additions & 3 deletions compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var parameter = (function(opt){
generate_exports: true,
export_local_property_definitions: true,
language_in: "ECMASCRIPT6_STRICT",
language_out: language_out || "ECMASCRIPT5_STRICT",
language_out: language_out || "ECMASCRIPT6_STRICT",
process_closure_primitives: true,
summary_detail_level: 3,
warning_level: "VERBOSE",
Expand Down Expand Up @@ -118,12 +118,12 @@ else{

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

if(release === "demo"){
if(release === "es5"){

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

fs.copyFileSync(filename, "docs/" + filename);
fs.copyFileSync(filename, "test/" + filename);
//fs.copyFileSync(filename, "dist/latest/" + filename);
fs.unlinkSync(filename);
}
Expand Down
43 changes: 18 additions & 25 deletions flexsearch.compact.js

Large diffs are not rendered by default.

46 changes: 24 additions & 22 deletions flexsearch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;/**!
* @preserve FlexSearch v0.3.1
* @preserve FlexSearch v0.3.2
* Copyright 2019 Nextapps GmbH
* Author: Thomas Wilkerling
* Released under the Apache 2.0 Licence
Expand Down Expand Up @@ -31,7 +31,7 @@
const defaults = {

encode: "icase",
mode: "forward",
tokenize: "forward",
suggest: false,
cache: false,
async: false,
Expand All @@ -53,39 +53,39 @@

"memory": {
encode: SUPPORT_ENCODER ? "extra" : "icase",
mode: "strict",
tokenize: "strict",
threshold: 7
},

"speed": {
encode: "icase",
mode: "strict",
tokenize: "strict",
threshold: 7,
depth: 2
},

"match": {
encode: SUPPORT_ENCODER ? "extra" : "icase",
mode: "full"
tokenize: "full"
},

"score": {
encode: SUPPORT_ENCODER ? "extra" : "icase",
mode: "strict",
tokenize: "strict",
threshold: 5,
depth: 4
},

"balance": {
encode: SUPPORT_ENCODER ? "balance" : "icase",
mode: "strict",
tokenize: "strict",
threshold: 6,
depth: 3
},

"fastest": {
encode: "icase",
mode: "strict",
tokenize: "strict",
threshold: 9,
depth: 1
}
Expand Down Expand Up @@ -361,12 +361,12 @@
// apply custom options

/** @private */
this.mode = (
this.tokenize = (

options["mode"] ||
profile.mode ||
this.mode ||
defaults.mode
options["tokenize"] ||
profile.tokenize ||
this.tokenize ||
defaults.tokenize
);

if(SUPPORT_ASYNC) /** @private */ this.async = (
Expand Down Expand Up @@ -674,7 +674,7 @@
return this;
}

const tokenizer = this.mode;
const tokenizer = this.tokenize;

const words = (

Expand Down Expand Up @@ -1046,7 +1046,7 @@

return;
}
else if(SUPPORT_ASYNC && !_recall && this.async){
else if(SUPPORT_ASYNC && !_recall && this.async && (typeof importScripts !== "function")){

/** @type {FlexSearch} */
let self = this;
Expand Down Expand Up @@ -1105,7 +1105,7 @@

// convert words into single components

const tokenizer = this.mode;
const tokenizer = this.tokenize;

const words = (

Expand Down Expand Up @@ -1136,7 +1136,7 @@
if(this.depth){

use_contextual = true;
// TODO: alternative roots
// TODO: iterate roots
ctx_root = words[0];
check_words[ctx_root] = 1;
}
Expand Down Expand Up @@ -1302,10 +1302,12 @@
"items": items,
"sequences": words,
"chars": chars,
//"status": this._cache_status,
"cache": this._stack_keys.length,
"matcher": global_matcher.length,
"worker": this.worker
"cache": this.cache && this.cache.ids ? this.cache.ids.length : false,
"matcher": global_matcher.length + (this._matcher ? this._matcher.length : 0),
"worker": this.worker,
"threshold": this.threshold,
"depth": this.depth,
"contextual": !!this.depth
};
};
}
Expand Down Expand Up @@ -2818,7 +2820,7 @@
:
// Load Extern Worker (but also requires CORS)

"../" + name + (RELEASE ? "." + RELEASE : "") + ".js"
name + (RELEASE ? "." + RELEASE : "") + ".js"
);

name += "-" + _id;
Expand Down
22 changes: 11 additions & 11 deletions flexsearch.light.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 784c37f

Please sign in to comment.