mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-09-02 10:23:50 +02:00
ADD proivide language packs
MOD remove language-specific lists from codebase MOD update readme
This commit is contained in:
221
README.md
221
README.md
@@ -1,3 +1,4 @@
|
|||||||
|
<p align="center"></p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<br>
|
<br>
|
||||||
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/flexsearch.svg" alt="Search Library" width="50%">
|
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/flexsearch.svg" alt="Search Library" width="50%">
|
||||||
@@ -10,12 +11,13 @@
|
|||||||
<img src="https://badges.greenkeeper.io/nextapps-de/flexsearch.svg">
|
<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>
|
<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>
|
</p>
|
||||||
|
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<h3>World's fastest and most memory efficient full text search library with zero dependencies.</h3>
|
<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://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.
|
||||||
It also has the __most memory-efficient index__. Keep in mind that updating / 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.
|
It also has the <a href="#memory">most memory-efficient index</a>.
|
||||||
|
<!--
|
||||||
|
Keep in mind that updating / 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.
|
||||||
|
-->
|
||||||
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.
|
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.
|
||||||
|
|
||||||
<a href="#installation">Installation Guide</a>  •  <a href="#api">API Reference</a>  •  <a href="#profiles">Example Options</a>  •  <a href="#builds">Custom Builds</a>
|
<a href="#installation">Installation Guide</a>  •  <a href="#api">API Reference</a>  •  <a href="#profiles">Example Options</a>  •  <a href="#builds">Custom Builds</a>
|
||||||
@@ -39,32 +41,30 @@ Supported Module Definitions:
|
|||||||
|
|
||||||
All Features:
|
All Features:
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#webworker">Web-Worker Support</a> (not available in Node.js)</li>
|
<li><a href="#webworker">Web-Worker Sharding</a> (not available in Node.js)</li>
|
||||||
<li><a href="#contextual">Contextual Indexes</a></li>
|
<li><a href="#contextual">Contextual Indexes</a></li>
|
||||||
<li>Partial Matching</li>
|
<li>Partial Matching</li>
|
||||||
<li>Multiple Words</li>
|
<li>Multi-Phrase Search</li>
|
||||||
<li><a href="#phonetic">Phonetic Search</a></li>
|
<li><a href="#phonetic">Phonetic Mathching</a></li>
|
||||||
<li>Relevance-based Scoring</li>
|
<li>Relevance-based Scoring</li>
|
||||||
<li>Auto-Balanced Cache by Popularity</li>
|
<li>Auto-Balanced Cache by Popularity</li>
|
||||||
<li>Limit Results</li>
|
<li>Suggestions (Results)</li>
|
||||||
<li>Supports Caching</li>
|
<li>Asynchronous Processing & Concurrency Control</li>
|
||||||
<li>Asynchronous Processing</li>
|
|
||||||
<li>Customizable: Matcher, Encoder, Tokenizer, Stemmer, Filter</li>
|
<li>Customizable: Matcher, Encoder, Tokenizer, Stemmer, Filter</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
These features are not available in the 50% smaller <a href="flexsearch.light.js">light version</a>:
|
These features are not available in the 50% smaller <a href="flexsearch.light.js">light version</a>:
|
||||||
|
|
||||||
- WebWorker
|
- WebWorker
|
||||||
- Asynchronous
|
- Asynchronous Processing
|
||||||
- Cache
|
- Cache
|
||||||
- Built-in encoders except 'balance' and 'icase' (you can still pass in customs)
|
- Built-in encoders except 'balance' and 'icase' (you can still pass in customs) <!--- Built-in stemmer and filter (you can still pass in customs)-->
|
||||||
- Built-in stemmer and filter (you can still pass in customs)
|
|
||||||
- Debug logging
|
- Debug logging
|
||||||
- _index.info()_ method
|
- Methods: _index.info()_
|
||||||
|
|
||||||
The light version is just available as compiled version (flexsearch.light.js).
|
The light version is just available as compiled version (<a href="flexsearch.light.js">flexsearch.light.js</a>).
|
||||||
|
|
||||||
> You can also make <a href="#builds">Custom Builds</a> pretty simple
|
> It is also pretty simple to make <a href="#builds">Custom Builds</a>
|
||||||
|
|
||||||
<a name="contextual"></a>
|
<a name="contextual"></a>
|
||||||
#### Contextual Search
|
#### Contextual Search
|
||||||
@@ -75,7 +75,7 @@ Imagine you add a text block of some sentences to an index ID. Assuming the quer
|
|||||||
In this way contextual search <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">also improves the results of relevance-based queries</a> on large amount of text data.
|
In this way contextual search <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">also improves the results of relevance-based queries</a> on large amount of text data.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/contextual_index.svg">
|
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/contextual-index.svg">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
__Note:__ This feature is actually not enabled by default.
|
__Note:__ This feature is actually not enabled by default.
|
||||||
@@ -105,7 +105,7 @@ __Note:__ It is slightly faster to use no web worker when the index or query isn
|
|||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Memory</td>
|
<td>Memory</td>
|
||||||
<td>Large: ~ 5 Mb per 100,000 words</td>
|
<td>Large: ~ 1 Mb per 100,000 words</td>
|
||||||
<td>Tiny: ~ 100 Kb per 100,000 words</td>
|
<td>Tiny: ~ 100 Kb per 100,000 words</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
@@ -138,6 +138,18 @@ __Note:__ It is slightly faster to use no web worker when the index or query isn
|
|||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Yes</td>
|
<td>Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr></tr>
|
||||||
|
<tr>
|
||||||
|
<td>Super-Partial-Matching</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>No</td>
|
||||||
|
</tr>
|
||||||
|
<tr></tr>
|
||||||
|
<tr>
|
||||||
|
<td>Wildcards (Query)</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
<td>No</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@@ -189,8 +201,8 @@ var FlexSearch = require("./flexsearch.js");
|
|||||||
|
|
||||||
Global methods:
|
Global methods:
|
||||||
- <a href="#flexsearch.create">FlexSearch.__create__(\<options\>)</a>
|
- <a href="#flexsearch.create">FlexSearch.__create__(\<options\>)</a>
|
||||||
- <a href="#flexsearch.addmatcher">FlexSearch.__addMatcher__({_KEY: VALUE_})</a>
|
- <a href="#flexsearch.registerMatcher">FlexSearch.__registerMatcher__({_KEY: VALUE_})</a>
|
||||||
- <a href="#flexsearch.register">FlexSearch.__register__(name, encoder)</a>
|
- <a href="#flexsearch.registerEncoder">FlexSearch.__registerEncoder__(name, encoder)</a>
|
||||||
- <a href="#flexsearch.encode">FlexSearch.__encode__(name, string)</a>
|
- <a href="#flexsearch.encode">FlexSearch.__encode__(name, string)</a>
|
||||||
|
|
||||||
Index methods:
|
Index methods:
|
||||||
@@ -275,6 +287,29 @@ index.search("John", function(result){
|
|||||||
// array of results
|
// array of results
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Pass custom options for each query:
|
||||||
|
|
||||||
|
```js
|
||||||
|
index.search({
|
||||||
|
|
||||||
|
query: "John",
|
||||||
|
limit: 1000,
|
||||||
|
threshold: 5, // >= initial threshold
|
||||||
|
depth: 3 // <= initial depth
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Get suggestions of a query:
|
||||||
|
|
||||||
|
```js
|
||||||
|
index.search({
|
||||||
|
|
||||||
|
query: "John",
|
||||||
|
suggest: true
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
<a name="index.update"></a>
|
<a name="index.update"></a>
|
||||||
#### Update item to the index
|
#### Update item to the index
|
||||||
|
|
||||||
@@ -325,11 +360,11 @@ index.init({
|
|||||||
<a name="flexsearch.addmatcher"></a>
|
<a name="flexsearch.addmatcher"></a>
|
||||||
#### Add custom matcher
|
#### Add custom matcher
|
||||||
|
|
||||||
> FlexSearch.__addMatcher({_REGEX: REPLACE_})__
|
> FlexSearch.__registerMatcher({_REGEX: REPLACE_})__
|
||||||
|
|
||||||
Add global matchers for all instances:
|
Add global matchers for all instances:
|
||||||
```js
|
```js
|
||||||
FlexSearch.addMatcher({
|
FlexSearch.registerMatcher({
|
||||||
|
|
||||||
'ä': 'a', // replaces all 'ä' to 'a'
|
'ä': 'a', // replaces all 'ä' to 'a'
|
||||||
'ó': 'o',
|
'ó': 'o',
|
||||||
@@ -364,10 +399,10 @@ var index = new FlexSearch({
|
|||||||
<a name="flexsearch.register"></a>
|
<a name="flexsearch.register"></a>
|
||||||
##### Register a global encoder to be used by all instances
|
##### Register a global encoder to be used by all instances
|
||||||
|
|
||||||
> FlexSearch.__register(name, encoder)__
|
> FlexSearch.__registerEncoder(name, encoder)__
|
||||||
|
|
||||||
```js
|
```js
|
||||||
FlexSearch.register('whitespace', function(str){
|
FlexSearch.registerEncoder('whitespace', function(str){
|
||||||
|
|
||||||
return str.replace(/ /g, '');
|
return str.replace(/ /g, '');
|
||||||
});
|
});
|
||||||
@@ -393,7 +428,7 @@ var encoded = FlexSearch.encode("whitespace", "sample text");
|
|||||||
##### Mixup/Extend multiple encoders
|
##### Mixup/Extend multiple encoders
|
||||||
|
|
||||||
```js
|
```js
|
||||||
FlexSearch.register('mixed', function(str){
|
FlexSearch.registerEncoder('mixed', function(str){
|
||||||
|
|
||||||
str = this.encode("icase", str); // built-in
|
str = this.encode("icase", str); // built-in
|
||||||
str = this.encode("whitespace", str); // custom
|
str = this.encode("whitespace", str); // custom
|
||||||
@@ -402,7 +437,7 @@ FlexSearch.register('mixed', function(str){
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
```js
|
```js
|
||||||
FlexSearch.register('extended', function(str){
|
FlexSearch.registerEncoder('extended', function(str){
|
||||||
|
|
||||||
str = this.encode("custom", str);
|
str = this.encode("custom", str);
|
||||||
|
|
||||||
@@ -426,18 +461,89 @@ var index = new FlexSearch({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
<a name="flexsearch.stemmer"></a>
|
||||||
|
#### Add language-specific stemmer and/or filter
|
||||||
|
|
||||||
|
> __Stemmer:__ several linguistic mutations of the same word (e.g. "run" and "running")
|
||||||
|
|
||||||
|
> __Filter:__ a blacklist of words to be filtered out from indexing at all (e.g. "and", "to" or "be")
|
||||||
|
|
||||||
|
Define a private custom stemmer or filter during creation/initialization:
|
||||||
|
```js
|
||||||
|
var index = new FlexSearch({
|
||||||
|
|
||||||
|
stemmer: {
|
||||||
|
|
||||||
|
// object {key: replacement}
|
||||||
|
"ational": "ate",
|
||||||
|
"tional": "tion",
|
||||||
|
"enci": "ence",
|
||||||
|
"ing": ""
|
||||||
|
},
|
||||||
|
filter: [
|
||||||
|
|
||||||
|
// array blacklist
|
||||||
|
"in",
|
||||||
|
"into",
|
||||||
|
"is",
|
||||||
|
"isn't",
|
||||||
|
"it",
|
||||||
|
"it's"
|
||||||
|
]
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Or assign stemmer/filters globally to a language:
|
||||||
|
```js
|
||||||
|
FlexSearch.registerLanguage('us', {
|
||||||
|
|
||||||
|
stemmer: {/* ... */},
|
||||||
|
filter: [/* ... */]
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Or use built-in stemmer or filter of your preferred languages:
|
||||||
|
```html
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="js/flexsearch.min.js"></script>
|
||||||
|
<script src="js/lang/en.min.js"></script>
|
||||||
|
<script src="js/lang/de.min.js"></script>
|
||||||
|
</head>
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you can assign built-in stemmer during creation/initialization:
|
||||||
|
```js
|
||||||
|
var index_en = new FlexSearch({stemmer: 'en', filter: 'en'});
|
||||||
|
var index_de = new FlexSearch({stemmer: 'de', filter: [/* custom */]});
|
||||||
|
```
|
||||||
|
|
||||||
|
In Node.js you just need require the language pack files to make them available:
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('lang/en.js');
|
||||||
|
require('lang/de.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
It is also possible to <a href="#builds">compile language packs into the build</a> as follows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node compile SUPPORT_LANG_EN=true SUPPORT_LANG_DE=true
|
||||||
|
```
|
||||||
|
|
||||||
<a name="index.info"></a>
|
<a name="index.info"></a>
|
||||||
#### Get info
|
#### Get info about an index
|
||||||
|
|
||||||
```js
|
```js
|
||||||
index.info();
|
index.info();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns information about the index, e.g.:
|
Returns information e.g.:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"bytes": 3600356288,
|
"bytes": 64000,
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"matchers": 0,
|
"matchers": 0,
|
||||||
"size": 10000,
|
"size": 10000,
|
||||||
@@ -462,7 +568,7 @@ index.remove(0).update(1, 'foo').add(2, 'foobar');
|
|||||||
|
|
||||||
#### Enable Contextual Index
|
#### Enable Contextual Index
|
||||||
|
|
||||||
Create context-enabled index and also set the limit of relevance (depth):
|
Create index and just set the limit of relevance ("depth"):
|
||||||
```js
|
```js
|
||||||
var index = new FlexSearch({
|
var index = new FlexSearch({
|
||||||
|
|
||||||
@@ -472,9 +578,20 @@ var index = new FlexSearch({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Use WebWorker (Browser only)
|
#### Enable Auto-Balanced Cache
|
||||||
|
|
||||||
Create worker-enabled index and also set the count of parallel threads:
|
Create index and just set a limit of cache entries:
|
||||||
|
```js
|
||||||
|
var index = new FlexSearch({
|
||||||
|
|
||||||
|
profile: "score",
|
||||||
|
cache: 10000
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Use WebWorker Sharding (Browser only)
|
||||||
|
|
||||||
|
Create index and just set the count of parallel threads:
|
||||||
```js
|
```js
|
||||||
var index = new FlexSearch({
|
var index = new FlexSearch({
|
||||||
|
|
||||||
@@ -581,7 +698,7 @@ FlexSearch ist highly customizable. Make use of the the <a href="#profiles">righ
|
|||||||
true<br>
|
true<br>
|
||||||
{number}
|
{number}
|
||||||
</td>
|
</td>
|
||||||
<td>Enable/Disable and/or set capacity of cached entries.<br><br>When passing a number as a limit the cache automatically balance stored entries related to their popularity.<br><br>Note: When just using "true" the cache has no limits and is actually 5 times faster (the balancer should not run).</td>
|
<td>Enable/Disable and/or set capacity of cached entries.<br><br>When passing a number as a limit the <b>cache automatically balance stored entries related to their popularity</b>.<br><br>Note: When just using "true" the cache has no limits and is actually 2-3 times faster (because the balancer do not have to run).</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -606,36 +723,38 @@ FlexSearch ist highly customizable. Make use of the the <a href="#profiles">righ
|
|||||||
<td align="top">depth<br><br></td>
|
<td align="top">depth<br><br></td>
|
||||||
<td>
|
<td>
|
||||||
false<br>
|
false<br>
|
||||||
{number}
|
{number:0-9}
|
||||||
</td>
|
</td>
|
||||||
<td>Enable/Disable <a href="#contextual">contextual indexing</a> and also sets relevance depth (experimental).</td>
|
<td>Enable/Disable <a href="#contextual">contextual indexing</a> and also sets contextual distance of relevance.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="top">threshold<br><br></td>
|
<td align="top">threshold<br><br></td>
|
||||||
<td>
|
<td>
|
||||||
false<br>
|
false<br>
|
||||||
{number}
|
{number:0-9}
|
||||||
</td>
|
</td>
|
||||||
<td>Enable/Disable the threshold of minimum relevance results should have.<br><br>Note: You can take a lower threshold for indexing and pass a higher value when calling .search(), but not other turn around.</td>
|
<td>Enable/Disable the threshold of minimum relevance all results should have.<br><br>Note: It is also possible to set a lower threshold for indexing and pass a higher value when calling <i>index.search(options)</i>.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="top">stemmer<br><br></td>
|
<td align="top">stemmer<br><br><br></td>
|
||||||
<td>
|
<td>
|
||||||
false<br>
|
false<br>
|
||||||
|
{string}<br>
|
||||||
{function}
|
{function}
|
||||||
</td>
|
</td>
|
||||||
<td>Disable or pass in custom object/array.</td>
|
<td>Disable or pass in language shorthand flag (ISO-3166) or a custom object.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="top">filter<br><br></td>
|
<td align="top">filter<br><br><br></td>
|
||||||
<td>
|
<td>
|
||||||
false<br>
|
false<br>
|
||||||
|
{string}<br>
|
||||||
{function}
|
{function}
|
||||||
</td>
|
</td>
|
||||||
<td>Disable or pass in custom object/array.</td>
|
<td>Disable or pass in language shorthand flag (ISO-3166) or a custom array.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -746,7 +865,7 @@ Encoding effects the required memory also as query time and phonetic matches. Tr
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<a name="compare" id="compare"></a>
|
<a name="compare" id="compare"></a>
|
||||||
#### Comparison (Matches)
|
#### Comparison (Matching)
|
||||||
|
|
||||||
> Reference String: __"Björn-Phillipp Mayer"__
|
> Reference String: __"Björn-Phillipp Mayer"__
|
||||||
|
|
||||||
@@ -954,9 +1073,7 @@ Memory-optimized profile: __"memory"__
|
|||||||
{
|
{
|
||||||
encode: "extra",
|
encode: "extra",
|
||||||
mode: "strict",
|
mode: "strict",
|
||||||
threshold: 7,
|
threshold: 7
|
||||||
stemmer: true,
|
|
||||||
filter: true
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -987,7 +1104,7 @@ Relevance-optimized profile: __"score"__
|
|||||||
encode: "extra",
|
encode: "extra",
|
||||||
mode: "strict",
|
mode: "strict",
|
||||||
threshold: 5,
|
threshold: 5,
|
||||||
depth: 4
|
depth: 5
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -1019,7 +1136,7 @@ Compare these options above:
|
|||||||
<a name="builds"></a>
|
<a name="builds"></a>
|
||||||
## Custom Builds
|
## Custom Builds
|
||||||
|
|
||||||
Default Build:
|
Full Build:
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
@@ -1029,6 +1146,11 @@ Light Build:
|
|||||||
npm run build-light
|
npm run build-light
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Build Language Packs:
|
||||||
|
```bash
|
||||||
|
npm run build-lang
|
||||||
|
```
|
||||||
|
|
||||||
Custom Build:
|
Custom Build:
|
||||||
```bash
|
```bash
|
||||||
npm run build-custom SUPPORT_WORKER=true SUPPORT_ASYNC=true
|
npm run build-custom SUPPORT_WORKER=true SUPPORT_ASYNC=true
|
||||||
@@ -1040,7 +1162,12 @@ Supported flags:
|
|||||||
- SUPPORT_WORKER
|
- SUPPORT_WORKER
|
||||||
- SUPPORT_CACHE
|
- SUPPORT_CACHE
|
||||||
- SUPPORT_ASYNC
|
- SUPPORT_ASYNC
|
||||||
- SUPPORT_BUILTINS (english stemmer and filter)
|
- SUPPORT_BUILTINS (built-in encoders)
|
||||||
|
|
||||||
|
Supported language flags (includes stemmer and filter):
|
||||||
|
|
||||||
|
- SUPPORT_LANG_EN
|
||||||
|
- SUPPORT_LANG_DE
|
||||||
|
|
||||||
Alternatively you can also use:
|
Alternatively you can also use:
|
||||||
```bash
|
```bash
|
||||||
|
95
compile.js
95
compile.js
@@ -1,41 +1,13 @@
|
|||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
|
|
||||||
|
var supported_lang = [
|
||||||
|
|
||||||
|
'en',
|
||||||
|
'de'
|
||||||
|
];
|
||||||
|
|
||||||
console.log("Start build .....");
|
console.log("Start build .....");
|
||||||
|
|
||||||
var parameter = (function(opt){
|
|
||||||
|
|
||||||
var parameter = '';
|
|
||||||
|
|
||||||
for(var index in opt){
|
|
||||||
|
|
||||||
if(opt.hasOwnProperty(index)){
|
|
||||||
|
|
||||||
parameter += ' --' + index + '=' + opt[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(parameter);
|
|
||||||
|
|
||||||
return parameter;
|
|
||||||
})({
|
|
||||||
|
|
||||||
compilation_level: "ADVANCED_OPTIMIZATIONS",
|
|
||||||
use_types_for_optimization: true,
|
|
||||||
new_type_inf: true,
|
|
||||||
jscomp_warning: "newCheckTypes",
|
|
||||||
generate_exports: true,
|
|
||||||
export_local_property_definitions: true,
|
|
||||||
language_in: "ECMASCRIPT5_STRICT",
|
|
||||||
language_out: "ECMASCRIPT5_STRICT",
|
|
||||||
process_closure_primitives: true,
|
|
||||||
summary_detail_level: 3,
|
|
||||||
warning_level: "VERBOSE",
|
|
||||||
emit_use_strict: true,
|
|
||||||
output_manifest: "log/manifest.log",
|
|
||||||
output_module_dependencies: "log/module_dependencies.log",
|
|
||||||
property_renaming_report: "log/renaming_report.log"
|
|
||||||
});
|
|
||||||
|
|
||||||
var options = (function(argv){
|
var options = (function(argv){
|
||||||
|
|
||||||
var arr = {};
|
var arr = {};
|
||||||
@@ -61,11 +33,62 @@ var options = (function(argv){
|
|||||||
|
|
||||||
})(process.argv);
|
})(process.argv);
|
||||||
|
|
||||||
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') + "' --js='flexsearch.js' --js_output_file='flexsearch." + (options['RELEASE'] || 'custom') + ".js' && exit 0", function(){
|
var parameter = (function(opt){
|
||||||
|
|
||||||
console.log("Build Complete: flexsearch." + (options['RELEASE'] || 'custom') + ".js");
|
var parameter = '';
|
||||||
|
|
||||||
|
for(var index in opt){
|
||||||
|
|
||||||
|
if(opt.hasOwnProperty(index)){
|
||||||
|
|
||||||
|
parameter += ' --' + index + '=' + opt[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(parameter);
|
||||||
|
|
||||||
|
return parameter;
|
||||||
|
})({
|
||||||
|
|
||||||
|
compilation_level: "ADVANCED_OPTIMIZATIONS",
|
||||||
|
use_types_for_optimization: true,
|
||||||
|
new_type_inf: true,
|
||||||
|
jscomp_warning: "newCheckTypes",
|
||||||
|
generate_exports: true,
|
||||||
|
export_local_property_definitions: true,
|
||||||
|
language_in: "ECMASCRIPT5_STRICT",
|
||||||
|
language_out: "ECMASCRIPT5_STRICT",
|
||||||
|
process_closure_primitives: true,
|
||||||
|
summary_detail_level: 3,
|
||||||
|
warning_level: "VERBOSE",
|
||||||
|
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"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(options['RELEASE'] === 'lang'){
|
||||||
|
|
||||||
|
for(var i = 0; i < supported_lang.length; i++){
|
||||||
|
|
||||||
|
(function(i){
|
||||||
|
|
||||||
|
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(){
|
||||||
|
|
||||||
|
console.log("Build Complete: " + supported_lang[i] + ".min.js");
|
||||||
|
});
|
||||||
|
|
||||||
|
})(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
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(){
|
||||||
|
|
||||||
|
console.log("Build Complete: flexsearch." + (options['RELEASE'] || 'custom') + ".js");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function exec(prompt, callback){
|
function exec(prompt, callback){
|
||||||
|
|
||||||
var child = child_process.exec(prompt, function(err, stdout, stderr){
|
var child = child_process.exec(prompt, function(err, stdout, stderr){
|
||||||
|
2
doc/contextual-index.svg
Normal file
2
doc/contextual-index.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 16 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 11 KiB |
323
flexsearch.js
323
flexsearch.js
@@ -1,5 +1,5 @@
|
|||||||
;/**!
|
;/**!
|
||||||
* @preserve FlexSearch v0.2.44
|
* @preserve FlexSearch v0.2.46
|
||||||
* Copyright 2018 Thomas Wilkerling
|
* Copyright 2018 Thomas Wilkerling
|
||||||
* Released under the Apache 2.0 Licence
|
* Released under the Apache 2.0 Licence
|
||||||
* https://github.com/nextapps-de/flexsearch
|
* https://github.com/nextapps-de/flexsearch
|
||||||
@@ -125,273 +125,9 @@ var SUPPORT_ASYNC = true;
|
|||||||
/** @const {RegExp} */
|
/** @const {RegExp} */
|
||||||
var regex_split = regex("[ -\/]");
|
var regex_split = regex("[ -\/]");
|
||||||
|
|
||||||
/**
|
var filter = {};
|
||||||
* http://www.ranks.nl/stopwords
|
|
||||||
* @const {Array<string>}
|
|
||||||
*/
|
|
||||||
|
|
||||||
var filter = [
|
var stemmer = {};
|
||||||
|
|
||||||
"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"
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @const {Object<string, string>}
|
|
||||||
*/
|
|
||||||
|
|
||||||
var stemmer = {
|
|
||||||
|
|
||||||
"ational": "ate",
|
|
||||||
"tional": "tion",
|
|
||||||
"enci": "ence",
|
|
||||||
"anci": "ance",
|
|
||||||
"izer": "ize",
|
|
||||||
"bli": "ble",
|
|
||||||
"alli": "al",
|
|
||||||
"entli": "ent",
|
|
||||||
"eli": "e",
|
|
||||||
"ousli": "ous",
|
|
||||||
"ization": "ize",
|
|
||||||
"ation": "ate",
|
|
||||||
"ator": "ate",
|
|
||||||
"alism": "al",
|
|
||||||
"iveness": "ive",
|
|
||||||
"fulness": "ful",
|
|
||||||
"ousness": "ous",
|
|
||||||
"aliti": "al",
|
|
||||||
"iviti": "ive",
|
|
||||||
"biliti": "ble",
|
|
||||||
"logi": "log",
|
|
||||||
"icate": "ic",
|
|
||||||
"ative": "",
|
|
||||||
"alize": "al",
|
|
||||||
"iciti": "ic",
|
|
||||||
"ical": "ic",
|
|
||||||
"ful": "",
|
|
||||||
"ness": "",
|
|
||||||
"al": "",
|
|
||||||
"ance": "",
|
|
||||||
"ence": "",
|
|
||||||
"er": "",
|
|
||||||
"ic": "",
|
|
||||||
"able": "",
|
|
||||||
"ible": "",
|
|
||||||
"ant": "",
|
|
||||||
"ement": "",
|
|
||||||
"ment": "",
|
|
||||||
"ent": "",
|
|
||||||
"ou": "",
|
|
||||||
"ism": "",
|
|
||||||
"ate": "",
|
|
||||||
"iti": "",
|
|
||||||
"ous": "",
|
|
||||||
"ive": "",
|
|
||||||
"ize": ""
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string|Object<string, number|string|boolean|Object|function(string):string>=} options
|
* @param {string|Object<string, number|string|boolean|Object|function(string):string>=} options
|
||||||
@@ -455,7 +191,7 @@ var SUPPORT_ASYNC = true;
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FlexSearch.addMatcher = function(matcher){
|
FlexSearch.registerMatcher = function(matcher){
|
||||||
|
|
||||||
for(var key in matcher){
|
for(var key in matcher){
|
||||||
|
|
||||||
@@ -475,13 +211,36 @@ var SUPPORT_ASYNC = true;
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FlexSearch.register = function(name, encoder){
|
FlexSearch.registerEncoder = function(name, encoder){
|
||||||
|
|
||||||
global_encoder[name] = encoder;
|
global_encoder[name] = encoder;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} lang
|
||||||
|
* @param {Object} language_pack
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
|
||||||
|
FlexSearch.registerLanguage = function(lang, language_pack){
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Array<string>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
filter[lang] = language_pack['filter'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object<string, string>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
stemmer[lang] = language_pack['stemmer'];
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!string} name
|
* @param {!string} name
|
||||||
* @param {?string} value
|
* @param {?string} value
|
||||||
@@ -646,32 +405,14 @@ var SUPPORT_ASYNC = true;
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SUPPORT_BUILTINS && (custom = options['filter'])) {
|
if((custom = options['filter'])) {
|
||||||
|
|
||||||
this.filter = initFilter(
|
this.filter = initFilter(filter[custom] || custom, this.encoder);
|
||||||
|
|
||||||
(custom === true ?
|
|
||||||
|
|
||||||
filter
|
|
||||||
:
|
|
||||||
/** @type {Array<string>} */
|
|
||||||
(custom)
|
|
||||||
|
|
||||||
), this.encoder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SUPPORT_BUILTINS && (custom = options['stemmer'])) {
|
if((custom = options['stemmer'])) {
|
||||||
|
|
||||||
this.stemmer = initStemmer(
|
this.stemmer = initStemmer(stemmer[custom] || custom, this.encoder);
|
||||||
|
|
||||||
(custom === true ?
|
|
||||||
|
|
||||||
stemmer
|
|
||||||
:
|
|
||||||
/** @type {Object<string, string>} */
|
|
||||||
(custom)
|
|
||||||
|
|
||||||
), this.encoder);
|
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@@ -1,18 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.2.44
|
FlexSearch v0.2.46
|
||||||
Copyright 2018 Thomas Wilkerling
|
Copyright 2018 Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';(function(d,u,p){var q;(q=p.define)&&q.amd?q([],function(){return u}):(q=p.modules)?q[d.toLowerCase()]=u:"undefined"!==typeof module?module.exports=u:p[d]=u})("FlexSearch",function(){function d(a){"string"===typeof a&&(a=A[a]);a||(a=x);this.id=a.id||E++;this.init(a);u(this,"index",function(){return this.a});u(this,"length",function(){return Object.keys(this.a).length})}function u(a,b,c){Object.defineProperty(a,b,{get:c})}function p(a){return new RegExp(a,"g")}function q(a,b,c){if("undefined"===
|
'use strict';(function(d,w,p){var q;(q=p.define)&&q.amd?q([],function(){return w}):(q=p.modules)?q[d.toLowerCase()]=w:"undefined"!==typeof module?module.exports=w:p[d]=w})("FlexSearch",function(){function d(a){"string"===typeof a&&(a=B[a]);a||(a=z);this.id=a.id||G++;this.init(a);w(this,"index",function(){return this.a});w(this,"length",function(){return Object.keys(this.a).length})}function w(a,b,c){Object.defineProperty(a,b,{get:c})}function p(a){return new RegExp(a,"g")}function q(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 v(a,b,c,l,g,h,e){if("undefined"===typeof b[c]){var f=g?(9-(e||6))*h+(e||6)*g:h;b[c]=f;f>=e&&(a=a[f+.5|0],a=a[c]||(a[c]=[]),a[a.length]=l)}return f||b[c]}function z(a,b){if(a)for(var c=Object.keys(a),l=0,g=c.length;l<g;l++){var h=c[l],e=a[h];if(e)for(var f=0,k=e.length;f<k;f++)if(e[f]===b){1===k?delete a[h]:e.splice(f,1);break}else"object"===typeof e[f]&&z(e[f],b)}}function B(a){var b=[];if(!a)return b;
|
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 y(a,b,c,f,g,m,e){if("undefined"===typeof b[c]){var h=g?(9-(e||6))*m+(e||6)*g:m;b[c]=h;h>=e&&(a=a[h+.5|0],a=a[c]||(a[c]=[]),a[a.length]=f)}return h||b[c]}function A(a,b){if(a)for(var c=Object.keys(a),f=0,g=c.length;f<g;f++){var m=c[f],e=a[m];if(e)for(var h=0,k=e.length;h<k;h++)if(e[h]===b){1===k?delete a[m]:e.splice(h,1);break}else"object"===typeof e[h]&&A(e[h],b)}}function C(a){var b=[];if(!a)return b;
|
||||||
for(var c=0,l=0,g=0,h="",e=a.length,f=0;f<e;f++){var k=a[f];"a"===k||"e"===k||"i"===k||"o"===k||"u"===k||"y"===k?c++:l++;" "!==k&&(h+=k);if(" "===k||c>=(8<e?2:1)&&2<=l||2<=c&&l>=(8<e?2:1)||f===e-1)h&&(b[g]&&2<h.length&&g++,b[g]=b[g]?b[g]+h:h," "===k&&g++,h=""),l=c=0}return b}function F(a,b){a=a.length-b.length;return 0>a?1:0<a?-1:0}function G(a,b){a=a.length-b.length;return 0>a?-1:0<a?1:0}function H(a,b){var c=[],l=a.length;if(1<l){a.sort(G);for(var g={},h=a[0],e=h.length,f=0;f<e;)g[h[f++]]=1;for(var k,
|
for(var c=0,f=0,g=0,m="",e=a.length,h=0;h<e;h++){var k=a[h];"a"===k||"e"===k||"i"===k||"o"===k||"u"===k||"y"===k?c++:f++;" "!==k&&(m+=k);if(" "===k||c>=(8<e?2:1)&&2<=f||2<=c&&f>=(8<e?2:1)||h===e-1)m&&(b[g]&&2<m.length&&g++,b[g]=b[g]?b[g]+m:m," "===k&&g++,m=""),f=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){var c=[],f=a.length;if(1<f){a.sort(I);for(var g={},m=a[0],e=m.length,h=0;h<e;)g[m[h++]]=1;for(var k,
|
||||||
C=0,n=1;n<l;){var d=!1;h=a[n];e=h.length;for(f=0;f<e;)if(g[k=h[f++]]===n){if(n===l-1&&(c[C++]=k,b&&C===b)){d=!1;break}d=!0;g[k]=n+1}if(!d)break;n++}}else if(l&&(c=a[0],b&&c.length>b))return c.slice(0,b);return c}var x={encode:"icase",mode:"ngram",cache:!1,async:!1,m:!1,threshold:0,depth:0},A={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",
|
d=0,n=1;n<f;){var u=!1;m=a[n];e=m.length;for(h=0;h<e;)if(g[k=m[h++]]===n){if(n===f-1&&(c[d++]=k,b&&d===b)){u=!1;break}u=!0;g[k]=n+1}if(!u)break;n++}}else if(f&&(c=a[0],b&&c.length>b))return c.slice(0,b);return c}var z={encode:"icase",mode:"ngram",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=[],E=0,D=p("[ -/]");d.new=function(a){return new this(a)};d.create=function(a){return d.new(a)};d.addMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&(w[w.length]=p(b),w[w.length]=a[b]);return this};d.register=function(a,b){y[a]=b;return this};d.encode=function(a,b){return y[a].call(y,b)};d.prototype.init=function(a){this.h=[];a||(a=x);var b=a.profile;b=b?A[b]:{};this.mode=a.mode||b.mode||this.mode||
|
mode:"ngram",threshold:6,depth:3},fastest:{encode:"icase",mode:"strict",threshold:9,depth:1}},x=[],G=0,D=p("[ -/]"),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)&&(x[x.length]=p(b),x[x.length]=a[b]);return this};d.registerEncoder=function(a,b){v[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 v[a].call(v,b)};d.prototype.init=
|
||||||
x.mode;this.threshold=a.threshold||b.threshold||this.threshold||x.threshold;this.depth=a.depth||b.depth||this.depth||x.depth;this.i=(b=a.encode||b.encode)&&y[b]||("function"===typeof b?b:this.i||!1);(b=a.matcher)&&this.addMatcher(b);this.f=[{},{},{},{},{},{},{},{},{},{}];this.b={};this.a={};this.c="";this.g=!0;return this};d.prototype.encode=function(a){a&&w.length&&(a=q(a,w));a&&this.h.length&&(a=q(a,this.h));a&&this.i&&(a=this.i.call(y,a));if(a&&this.j){a=a.split(" ");for(var b=0;b<a.length;b++){var c=
|
function(a){this.i=[];a||(a=z);var b=a.profile;b=b?B[b]:{};this.mode=a.mode||b.mode||this.mode||z.mode;this.threshold=a.threshold||b.threshold||this.threshold||z.threshold;this.depth=a.depth||b.depth||this.depth||z.depth;this.f=(b=a.encode||b.encode)&&v[b]||("function"===typeof b?b:this.f||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){b=E[b]||b;var c=this.f,f={};if(b)for(var g=0;g<b.length;g++){var m=c?c.call(v,b[g]):b[g];f[m]=String.fromCharCode(65E3-b.length+g)}this.filter=f}if(b=a.stemmer){a=
|
||||||
this.j[a[b]];c&&(a[b]=c)}a=a.join(" ")}a&&this.l&&(a=q(a,this.l));return a};d.prototype.addMatcher=function(a){var b=this.h,c;for(c in a)a.hasOwnProperty(c)&&(b[b.length]=p(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?B(b):b.split(D);for(var l={_ctx:{}},g=this.threshold,h=this.depth,e=this.f,f=b.length,k=0;k<
|
F[b]||b;b=this.f;c=[];if(a){f=0;for(var e in a)a.hasOwnProperty(e)&&(g=b?b.call(v,e):e,c[f++]=p("(?=.{"+(g.length+3)+",})"+g+"$"),c[f++]=b?b.call(v,a[e]):a[e])}this.stemmer=c}this.g=[{},{},{},{},{},{},{},{},{},{}];this.b={};this.a={};this.c="";this.h=!0;return this};d.prototype.encode=function(a){a&&x.length&&(a=q(a,x));a&&this.i.length&&(a=q(a,this.i));a&&this.f&&(a=this.f.call(v,a));if(a&&this.filter){a=a.split(" ");for(var b=0;b<a.length;b++){var c=this.filter[a[b]];c&&(a[b]=c)}a=a.join(" ")}a&&
|
||||||
f;k++){var d=b[k];if(d){var n=d.length,p=(f-k)/f;switch(c){case "reverse":case "both":for(var r="",m=n-1;1<=m;m--)r=d[m]+r,v(e,l,r,a,(n-m)/n,p,g);case "forward":r="";for(m=0;m<n;m++)r+=d[m],v(e,l,r,a,1,p,g);break;case "full":for(m=0;m<n;m++)for(var q=(n-m)/n,t=n;t>m;t--)r=d.substring(m,t),v(e,l,r,a,q,p,g);break;default:if(m=v(e,l,d,a,1,p,g),h&&1<f&&m>=g)for(n=l._ctx[d]||(l._ctx[d]={}),d=this.b[d]||(this.b[d]=[{},{},{},{},{},{},{},{},{},{}]),m=k-h,t=k+h+1,0>m&&(m=0),t>f&&(t=f);m<t;m++)m!==k&&v(d,n,
|
this.stemmer&&(a=q(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]=p(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 f={_ctx:{}},g=this.threshold,m=this.depth,e=this.g,h=b.length,k=0;k<h;k++){var d=b[k];if(d){var n=
|
||||||
b[m],a,0,10-(m<k?k-m:m-k),g)}}}this.a[a]="1";this.g=!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++)z(this.f[b],a);this.depth&&z(this.b,a);delete this.a[a];this.g=!1}return this};d.prototype.search=function(a,b,c){var l=[];if(a&&"object"===typeof a){c=a.callback||b;b=a.limit;var d=a.threshold;a=a.query}d=(d||this.threshold||0)|0;"function"===typeof b?
|
d.length,u=(h-k)/h;switch(c){case "reverse":case "both":for(var r="",l=n-1;1<=l;l--)r=d[l]+r,y(e,f,r,a,(n-l)/n,u,g);case "forward":r="";for(l=0;l<n;l++)r+=d[l],y(e,f,r,a,1,u,g);break;case "full":for(l=0;l<n;l++)for(var p=(n-l)/n,t=n;t>l;t--)r=d.substring(l,t),y(e,f,r,a,p,u,g);break;default:if(l=y(e,f,d,a,1,u,g),m&&1<h&&l>=g)for(n=f._ctx[d]||(f._ctx[d]={}),d=this.b[d]||(this.b[d]=[{},{},{},{},{},{},{},{},{},{}]),l=k-m,t=k+m+1,0>l&&(l=0),t>h&&(t=h);l<t;l++)l!==k&&y(d,n,b[l],a,0,10-(l<k?k-l:l-k),g)}}}this.a[a]=
|
||||||
(c=b,b=1E3):b||(b=1E3);if(c){var h=this;I(function(){c(h.search(a,b));h=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return l;if(!this.g)this.g=!0;else if(this.c&&0===a.indexOf(this.c))return l;var e=this.encode(a);if(!e.length)return l;var f=this.mode;e="function"===typeof f?f(e):"ngram"===f?B(e):e.split(D);f=e.length;var k=!0,p=[],n={};if(1<f)if(this.depth){var q=!0,r=e[0];n[r]="1"}else e.sort(F);var m;if(!q||(m=this.b)[r])for(var u=q?1:0;u<f;u++){var t=e[u];if(t&&!n[t]){for(var w,
|
"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 f=[];if(a&&"object"===typeof a){c=a.callback||b;b=a.limit;var g=a.threshold;a=a.query}g=(g||this.threshold||0)|0;"function"===typeof b?(c=b,b=1E3):b||(b=1E3);if(c){var d=this;
|
||||||
x=!1,v=[],y=0,z=9;z>=d;z--)if(w=(q?m[r]:this.f)[z][t])v[y++]=w,x=!0;if(x)p[p.length]=1<y?p.concat.apply([],v):v[0];else{k=!1;break}n[t]="1"}r=t}else k=!1;k&&(l=H(p,b));l.length?this.c="":this.c||(this.c=a);return l};d.prototype.reset=function(){this.destroy();return this.init()};d.prototype.destroy=function(){this.j=this.l=this.f=this.b=this.a=null;return this};var y={icase:function(a){return a.toLowerCase()},balance:function(){var a=[p("[-/]")," ",p("[^a-z0-9 ]"),"",p("\\s\\s+")," "];return function(b){b=
|
K(function(){c(d.search(a,b));d=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return f;if(!this.h)this.h=!0;else if(this.c&&0===a.indexOf(this.c))return f;var e=this.encode(a);if(!e.length)return f;var h=this.mode;e="function"===typeof h?h(e):"ngram"===h?C(e):e.split(D);h=e.length;var k=!0,p=[],n={};if(1<h)if(this.depth){var u=!0,r=e[0];n[r]="1"}else e.sort(H);var l;if(!u||(l=this.b)[r])for(var q=u?1:0;q<h;q++){var t=e[q];if(t&&!n[t]){for(var v,w=!1,x=[],z=0,y=9;y>=g;y--)if(v=
|
||||||
q(b.toLowerCase(),a);for(var c="",d="",g="",h=0;h<b.length;h++){var e=b[h];if(e!==d)if(h&&"h"===e){if(g="a"===g||"e"===g||"i"===g||"o"===g||"u"===g||"y"===g,("a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d)&&g||" "===d)c+=e}else c+=e;g=h===b.length-1?"":b[h+1];d=e}return c}}()},I=null;return d}(!1),this);
|
(u?l[r]:this.g)[y][t])x[z++]=v,w=!0;if(w)p[p.length]=1<z?p.concat.apply([],x):x[0];else{k=!1;break}n[t]="1"}r=t}else k=!1;k&&(f=J(p,b));f.length?this.c="":this.c||(this.c=a);return f};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 v={icase:function(a){return a.toLowerCase()},balance:function(){var a=[p("[-/]")," ",p("[^a-z0-9 ]"),"",p("\\s\\s+")," "];return function(b){b=q(b.toLowerCase(),
|
||||||
|
a);for(var c="",f="",g="",d=0;d<b.length;d++){var e=b[d];if(e!==f)if(d&&"h"===e){if(g="a"===g||"e"===g||"i"===g||"o"===g||"u"===g||"y"===g,("a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f)&&g||" "===f)c+=e}else c+=e;g=d===b.length-1?"":b[d+1];f=e}return c}}()},K=null;return d}(!1),this);
|
||||||
|
47
flexsearch.min.js
vendored
47
flexsearch.min.js
vendored
@@ -1,31 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.2.44
|
FlexSearch v0.2.46
|
||||||
Copyright 2018 Thomas Wilkerling
|
Copyright 2018 Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';(function(q,B,g){var t;(t=g.define)&&t.amd?t([],function(){return B}):(t=g.modules)?t[q.toLowerCase()]=B:"undefined"!==typeof module?module.exports=B:g[q]=B})("FlexSearch",function K(q){function g(a){"string"===typeof a&&(a=F[a]);a||(a=x);this.id=a.id||L++;this.init(a);t(this,"index",function(){return this.a});t(this,"length",function(){return Object.keys(this.a).length})}function t(a,b,d){Object.defineProperty(a,b,{get:d})}function e(a){return new RegExp(a,"g")}function y(a,b,d){if("undefined"===
|
'use strict';(function(q,B,g){var t;(t=g.define)&&t.amd?t([],function(){return B}):(t=g.modules)?t[q.toLowerCase()]=B:"undefined"!==typeof module?module.exports=B:g[q]=B})("FlexSearch",function M(q){function g(a){"string"===typeof a&&(a=F[a]);a||(a=x);this.id=a.id||N++;this.init(a);t(this,"index",function(){return this.a});t(this,"length",function(){return Object.keys(this.a).length})}function t(a,b,d){Object.defineProperty(a,b,{get:d})}function e(a){return new RegExp(a,"g")}function y(a,b,d){if("undefined"===
|
||||||
typeof d){for(d=0;d<b.length;d+=2)a=a.replace(b[d],b[d+1]);return a}return a.replace(b,d)}function u(a,b,d,c,f,m,k){if("undefined"===typeof b[d]){var h=f?(9-(k||6))*m+(k||6)*f:m;b[d]=h;h>=k&&(a=a[h+.5|0],a=a[d]||(a[d]=[]),a[a.length]=c)}return h||b[d]}function n(a,b){if(a)for(var d=Object.keys(a),c=0,f=d.length;c<f;c++){var m=d[c],k=a[m];if(k)for(var h=0,e=k.length;h<e;h++)if(k[h]===b){1===e?delete a[m]:k.splice(h,1);break}else"object"===typeof k[h]&&n(k[h],b)}}function G(a){var b=[];if(!a)return b;
|
typeof d){for(d=0;d<b.length;d+=2)a=a.replace(b[d],b[d+1]);return a}return a.replace(b,d)}function u(a,b,d,c,f,m,k){if("undefined"===typeof b[d]){var h=f?(9-(k||6))*m+(k||6)*f:m;b[d]=h;h>=k&&(a=a[h+.5|0],a=a[d]||(a[d]=[]),a[a.length]=c)}return h||b[d]}function n(a,b){if(a)for(var d=Object.keys(a),c=0,f=d.length;c<f;c++){var m=d[c],k=a[m];if(k)for(var h=0,e=k.length;h<e;h++)if(k[h]===b){1===e?delete a[m]:k.splice(h,1);break}else"object"===typeof k[h]&&n(k[h],b)}}function G(a){var b=[];if(!a)return b;
|
||||||
for(var d=0,c=0,f=0,m="",k=a.length,h=0;h<k;h++){var e=a[h];"a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e?d++:c++;" "!==e&&(m+=e);if(" "===e||d>=(8<k?2:1)&&2<=c||2<=d&&c>=(8<k?2:1)||h===k-1)m&&(b[f]&&2<m.length&&f++,b[f]=b[f]?b[f]+m:m," "===e&&f++,m=""),c=d=0}return b}function D(a){for(var b="",d="",c="",f=0;f<a.length;f++){var m=a[f];if(m!==d)if(f&&"h"===m){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d)&&c||" "===d)b+=m}else b+=
|
for(var d=0,c=0,f=0,m="",k=a.length,h=0;h<k;h++){var e=a[h];"a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e?d++:c++;" "!==e&&(m+=e);if(" "===e||d>=(8<k?2:1)&&2<=c||2<=d&&c>=(8<k?2:1)||h===k-1)m&&(b[f]&&2<m.length&&f++,b[f]=b[f]?b[f]+m:m," "===e&&f++,m=""),c=d=0}return b}function D(a){for(var b="",d="",c="",f=0;f<a.length;f++){var m=a[f];if(m!==d)if(f&&"h"===m){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d)&&c||" "===d)b+=m}else b+=
|
||||||
m;c=f===a.length-1?"":a[f+1];d=m}return b}function M(a,b){var d={};if(a)for(var c=0;c<a.length;c++){var f=b?b.call(z,a[c]):a[c];d[f]=String.fromCharCode(65E3-a.length+c)}return d}function N(a,b){var d=[];if(a){var c=0,f;for(f in a)if(a.hasOwnProperty(f)){var m=b?b.call(z,f):f;d[c++]=e("(?=.{"+(m.length+3)+",})"+m+"$");d[c++]=b?b.call(z,a[f]):a[f]}}return d}function O(a,b){a=a.length-b.length;return 0>a?1:0<a?-1:0}function P(a,b){a=a.length-b.length;return 0>a?-1:0<a?1:0}function Q(a,b){var d=[],c=
|
m;c=f===a.length-1?"":a[f+1];d=m}return b}function O(a,b){var d={};if(a)for(var c=0;c<a.length;c++){var f=b?b.call(z,a[c]):a[c];d[f]=String.fromCharCode(65E3-a.length+c)}return d}function P(a,b){var d=[];if(a){var c=0,f;for(f in a)if(a.hasOwnProperty(f)){var m=b?b.call(z,f):f;d[c++]=e("(?=.{"+(m.length+3)+",})"+m+"$");d[c++]=b?b.call(z,a[f]):a[f]}}return d}function Q(a,b){a=a.length-b.length;return 0>a?1:0<a?-1:0}function R(a,b){a=a.length-b.length;return 0>a?-1:0<a?1:0}function S(a,b){var d=[],c=
|
||||||
a.length;if(1<c){a.sort(P);for(var f={},m=a[0],e=m.length,h=0;h<e;)f[m[h++]]=1;for(var g,r=0,p=1;p<c;){var n=!1;m=a[p];e=m.length;for(h=0;h<e;)if(f[g=m[h++]]===p){if(p===c-1&&(d[r++]=g,b&&r===b)){n=!1;break}n=!0;f[g]=p+1}if(!n)break;p++}}else if(c&&(d=a[0],b&&d.length>b))return d.slice(0,b);return d}function E(a){a.D||(a.D=H(function(){a.D=null;var b=a.async;b&&(a.async=!1);if(a.f.length){for(var d=I(),c;(c=a.f.shift())||0===c;){var f=a.h[c];switch(f[0]){case C.add:a.add(f[1],f[2]);break;case C.update:a.update(f[1],
|
a.length;if(1<c){a.sort(R);for(var f={},m=a[0],e=m.length,h=0;h<e;)f[m[h++]]=1;for(var g,r=0,p=1;p<c;){var n=!1;m=a[p];e=m.length;for(h=0;h<e;)if(f[g=m[h++]]===p){if(p===c-1&&(d[r++]=g,b&&r===b)){n=!1;break}n=!0;f[g]=p+1}if(!n)break;p++}}else if(c&&(d=a[0],b&&d.length>b))return d.slice(0,b);return d}function E(a){a.C||(a.C=H(function(){a.C=null;var b=a.async;b&&(a.async=!1);if(a.f.length){for(var d=I(),c;(c=a.f.shift())||0===c;){var f=a.h[c];switch(f[0]){case C.add:a.add(f[1],f[2]);break;case C.update:a.update(f[1],
|
||||||
f[2]);break;case C.remove:a.remove(f[1])}a.h[c]=null;delete a.h[c];if(100<I()-d)break}a.f.length&&E(a)}b&&(a.async=b)},1,"search-async-"+a.id))}function I(){return"undefined"!==typeof performance?performance.now():(new Date).getTime()}function R(a,b,d,c){a=q("flexsearch","id"+a,function(){var a,b;self.a=function(c){if(c=c.data)if(c.search){var d=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:d})}else c.add?
|
f[2]);break;case C.remove:a.remove(f[1])}a.h[c]=null;delete a.h[c];if(100<I()-d)break}a.f.length&&E(a)}b&&(a.async=b)},1,"search-async-"+a.id))}function I(){return"undefined"!==typeof performance?performance.now():(new Date).getTime()}function T(a,b,d,c){a=q("flexsearch","id"+a,function(){var a,b;self.a=function(c){if(c=c.data)if(c.search){var d=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:d})}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.G&&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):d.debug&&console.log(a)},b);var f=K.toString();d.id=b;a.postMessage(b,{register:f,options:d,
|
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.D&&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):d.debug&&console.log(a)},b);var f=M.toString();d.id=b;a.postMessage(b,{register:f,options:d,
|
||||||
id:b});return a}var x={encode:"icase",mode:"ngram",cache:!1,async:!1,b:!1,threshold:0,depth:0},F={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}},A=[],L=0,C={add:0,update:1,remove:2},J=e("[ -/]"),S="a about above after again against all also am an and any are aren't as at be because been before being below both but by can cannot can't come could couldn't did didn't do does doesn't doing dont down during each even few first for from further get go had hadn't has hasn't have haven't having he hed 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 make me more most mustn't my myself new no nor not now of off on once only or other ought our our's ourselves out over own same say see shan't she she'd shell shes should shouldn't so some such than that that's the their theirs them themselves then there there's these they they'd they'll they're they've this those through time to too until up us 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 would wouldn't you you'd you'll your you're your's yourself yourselves you've".split(" "),
|
id:b});return a}var x={encode:"icase",mode:"ngram",cache:!1,async:!1,b:!1,threshold:0,depth:0},F={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}},A=[],N=0,C={add:0,update:1,remove:2},J=e("[ -/]"),K={},L={};g.new=function(a){return new this(a)};
|
||||||
T={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log",icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:"",al:"",ance:"",ence:"",er:"",ic:"",able:"",ible:"",ant:"",ement:"",ment:"",ent:"",ou:"",ism:"",ate:"",iti:"",ous:"",ive:"",ize:""};g.new=function(a){return new this(a)};g.create=function(a){return g.new(a)};
|
g.create=function(a){return g.new(a)};g.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&(A[A.length]=e(b),A[A.length]=a[b]);return this};g.registerEncoder=function(a,b){z[a]=b;return this};g.registerLanguage=function(a,b){K[a]=b.filter;L[a]=b.stemmer;return this};g.encode=function(a,b){return z[a].call(z,b)};g.prototype.init=function(a){this.B=[];a||(a=x);var b=a.profile,d=b?F[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,
|
||||||
g.addMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&(A[A.length]=e(b),A[A.length]=a[b]);return this};g.register=function(a,b){z[a]=b;return this};g.encode=function(a,b){return z[a].call(z,b)};g.prototype.init=function(a){this.C=[];a||(a=x);var b=a.profile,d=b?F[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.w=null;c.i=Array(b);for(var f=0;f<b;f++)c.i[f]=R(c.id,f,a||x,function(a,b,d,f){c.m!==c.b&&
|
10)||4;c.s=-1;c.m=0;c.g=[];c.w=null;c.i=Array(b);for(var f=0;f<b;f++)c.i[f]=T(c.id,f,a||x,function(a,b,d,f){c.m!==c.b&&(c.g=c.g.concat(d),c.m++,f&&c.g.length>=f&&(c.m=c.b),c.w&&c.m===c.b&&(c.g.length?c.c="":c.c||(c.c=b),c.cache&&c.j.set(b,c.g),c.w(c.g),c.g=[]))})}this.mode=a.mode||d.mode||this.mode||x.mode;this.async=a.async||this.async||x.async;this.b=a.worker||this.b||x.b;this.threshold=a.threshold||d.threshold||this.threshold||x.threshold;this.depth=a.depth||d.depth||this.depth||x.depth;this.v=
|
||||||
(c.g=c.g.concat(d),c.m++,f&&c.g.length>=f&&(c.m=c.b),c.w&&c.m===c.b&&(c.g.length?c.c="":c.c||(c.c=b),c.cache&&c.j.set(b,c.g),c.w(c.g),c.g=[]))})}this.mode=a.mode||d.mode||this.mode||x.mode;this.async=a.async||this.async||x.async;this.b=a.worker||this.b||x.b;this.threshold=a.threshold||d.threshold||this.threshold||x.threshold;this.depth=a.depth||d.depth||this.depth||x.depth;this.v=(b=a.encode||d.encode)&&z[b]||("function"===typeof b?b:this.v||!1);this.G=a.debug||this.G;(b=a.matcher)&&this.addMatcher(b);
|
(b=a.encode||d.encode)&&z[b]||("function"===typeof b?b:this.v||!1);this.D=a.debug||this.D;(b=a.matcher)&&this.addMatcher(b);if(b=a.filter)this.filter=O(K[b]||b,this.v);if(b=a.stemmer)this.stemmer=P(L[b]||b,this.v);this.l=[{},{},{},{},{},{},{},{},{},{}];this.o={};this.a={};this.h={};this.f=[];this.C=null;this.c="";this.u=!0;this.j=(this.cache=b=a.cache||this.cache||x.cache)?new U(b):!1;return this};g.prototype.encode=function(a){a&&A.length&&(a=y(a,A));a&&this.B.length&&(a=y(a,this.B));a&&this.v&&
|
||||||
if(b=a.filter)this.B=M(!0===b?S:b,this.v);if(b=a.stemmer)this.F=N(!0===b?T:b,this.v);this.l=[{},{},{},{},{},{},{},{},{},{}];this.o={};this.a={};this.h={};this.f=[];this.D=null;this.c="";this.u=!0;this.j=(this.cache=b=a.cache||this.cache||x.cache)?new U(b):!1;return this};g.prototype.encode=function(a){a&&A.length&&(a=y(a,A));a&&this.C.length&&(a=y(a,this.C));a&&this.v&&(a=this.v.call(z,a));if(a&&this.B){a=a.split(" ");for(var b=0;b<a.length;b++){var d=this.B[a[b]];d&&(a[b]=d)}a=a.join(" ")}a&&this.F&&
|
(a=this.v.call(z,a));if(a&&this.filter){a=a.split(" ");for(var b=0;b<a.length;b++){var d=this.filter[a[b]];d&&(a[b]=d)}a=a.join(" ")}a&&this.stemmer&&(a=y(a,this.stemmer));return a};g.prototype.addMatcher=function(a){var b=this.B,d;for(d in a)a.hasOwnProperty(d)&&(b[b.length]=e(d),b[b.length]=a[d]);return this};g.prototype.add=function(a,b,d){if("string"===typeof b&&b&&(a||0===a))if(this.a[a]&&!d)this.update(a,b);else{if(this.b)return++this.s>=this.i.length&&(this.s=0),this.i[this.s].postMessage(this.s,
|
||||||
(a=y(a,this.F));return a};g.prototype.addMatcher=function(a){var b=this.C,d;for(d in a)a.hasOwnProperty(d)&&(b[b.length]=e(d),b[b.length]=a[d]);return this};g.prototype.add=function(a,b,d){if("string"===typeof b&&b&&(a||0===a))if(this.a[a]&&!d)this.update(a,b);else{if(this.b)return++this.s>=this.i.length&&(this.s=0),this.i[this.s].postMessage(this.s,{add:!0,id:a,content:b}),this.a[a]=""+this.s,this;if(this.async)return this.h[a]||(this.f[this.f.length]=a),this.h[a]=[C.add,a,b],E(this),this;b=this.encode(b);
|
{add:!0,id:a,content:b}),this.a[a]=""+this.s,this;if(this.async)return this.h[a]||(this.f[this.f.length]=a),this.h[a]=[C.add,a,b],E(this),this;b=this.encode(b);if(!b.length)return this;d=this.mode;b="function"===typeof d?d(b):"ngram"===d?G(b):b.split(J);for(var c={_ctx:{}},f=this.threshold,e=this.depth,k=this.l,h=b.length,g=0;g<h;g++){var r=b[g];if(r){var p=r.length,n=(h-g)/h;switch(d){case "reverse":case "both":for(var v="",l=p-1;1<=l;l--)v=r[l]+v,u(k,c,v,a,(p-l)/p,n,f);case "forward":v="";for(l=
|
||||||
if(!b.length)return this;d=this.mode;b="function"===typeof d?d(b):"ngram"===d?G(b):b.split(J);for(var c={_ctx:{}},f=this.threshold,e=this.depth,k=this.l,h=b.length,g=0;g<h;g++){var r=b[g];if(r){var p=r.length,n=(h-g)/h;switch(d){case "reverse":case "both":for(var v="",l=p-1;1<=l;l--)v=r[l]+v,u(k,c,v,a,(p-l)/p,n,f);case "forward":v="";for(l=0;l<p;l++)v+=r[l],u(k,c,v,a,1,n,f);break;case "full":for(l=0;l<p;l++)for(var q=(p-l)/p,w=p;w>l;w--)v=r.substring(l,w),u(k,c,v,a,q,n,f);break;default:if(l=u(k,c,
|
0;l<p;l++)v+=r[l],u(k,c,v,a,1,n,f);break;case "full":for(l=0;l<p;l++)for(var q=(p-l)/p,w=p;w>l;w--)v=r.substring(l,w),u(k,c,v,a,q,n,f);break;default:if(l=u(k,c,r,a,1,n,f),e&&1<h&&l>=f)for(p=c._ctx[r]||(c._ctx[r]={}),r=this.o[r]||(this.o[r]=[{},{},{},{},{},{},{},{},{},{}]),l=g-e,w=g+e+1,0>l&&(l=0),w>h&&(w=h);l<w;l++)l!==g&&u(r,p,b[l],a,0,10-(l<g?g-l:l-g),f)}}}this.a[a]="1";this.u=!1}return this};g.prototype.update=function(a,b){this.a[a]&&b&&"string"===typeof b&&(this.remove(a),this.add(a,b,!0));return this};
|
||||||
r,a,1,n,f),e&&1<h&&l>=f)for(p=c._ctx[r]||(c._ctx[r]={}),r=this.o[r]||(this.o[r]=[{},{},{},{},{},{},{},{},{},{}]),l=g-e,w=g+e+1,0>l&&(l=0),w>h&&(w=h);l<w;l++)l!==g&&u(r,p,b[l],a,0,10-(l<g?g-l:l-g),f)}}}this.a[a]="1";this.u=!1}return this};g.prototype.update=function(a,b){this.a[a]&&b&&"string"===typeof b&&(this.remove(a),this.add(a,b,!0));return this};g.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.h[a]||
|
g.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.h[a]||(this.f[this.f.length]=a),this.h[a]=[C.remove,a],E(this),this;for(b=0;10>b;b++)n(this.l[b],a);this.depth&&n(this.o,a);delete this.a[a];this.u=!1}return this};g.prototype.search=function(a,b,d){var c=[];if(a&&"object"===typeof a){d=a.callback||b;b=a.limit;var f=a.threshold;a=a.query}f=(f||this.threshold||0)|0;"function"===
|
||||||
(this.f[this.f.length]=a),this.h[a]=[C.remove,a],E(this),this;for(b=0;10>b;b++)n(this.l[b],a);this.depth&&n(this.o,a);delete this.a[a];this.u=!1}return this};g.prototype.search=function(a,b,d){var c=[];if(a&&"object"===typeof a){d=a.callback||b;b=a.limit;var f=a.threshold;a=a.query}f=(f||this.threshold||0)|0;"function"===typeof b?(d=b,b=1E3):b||(b=1E3);if(this.b){this.w=d;this.m=0;this.g=[];for(c=0;c<this.b;c++)this.i[c].postMessage(c,{search:!0,limit:b,threshold:f,content:a});return null}if(d){var e=
|
typeof b?(d=b,b=1E3):b||(b=1E3);if(this.b){this.w=d;this.m=0;this.g=[];for(c=0;c<this.b;c++)this.i[c].postMessage(c,{search:!0,limit:b,threshold:f,content:a});return null}if(d){var e=this;H(function(){d(e.search(a,b));e=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return c;var k=a;if(!this.u)this.cache&&(this.c="",this.j.reset()),this.u=!0;else if(this.cache){var h=this.j.get(a);if(h)return h}else if(this.c&&0===a.indexOf(this.c))return c;k=this.encode(k);if(!k.length)return c;
|
||||||
this;H(function(){d(e.search(a,b));e=null},1,"search-"+this.id);return null}if(!a||"string"!==typeof a)return c;var k=a;if(!this.u)this.cache&&(this.c="",this.j.reset()),this.u=!0;else if(this.cache){var h=this.j.get(a);if(h)return h}else if(this.c&&0===a.indexOf(this.c))return c;k=this.encode(k);if(!k.length)return c;h=this.mode;k="function"===typeof h?h(k):"ngram"===h?G(k):k.split(J);h=k.length;var g=!0,n=[],p={};if(1<h)if(this.depth){var q=!0,v=k[0];p[v]="1"}else k.sort(O);var l;if(!q||(l=this.o)[v])for(var t=
|
h=this.mode;k="function"===typeof h?h(k):"ngram"===h?G(k):k.split(J);h=k.length;var g=!0,n=[],p={};if(1<h)if(this.depth){var q=!0,v=k[0];p[v]="1"}else k.sort(Q);var l;if(!q||(l=this.o)[v])for(var t=q?1:0;t<h;t++){var w=k[t];if(w&&!p[w]){for(var x,y=!1,u=[],z=0,A=9;A>=f;A--)if(x=(q?l[v]:this.l)[A][w])u[z++]=x,y=!0;if(y)n[n.length]=1<z?n.concat.apply([],u):u[0];else{g=!1;break}p[w]="1"}v=w}else g=!1;g&&(c=S(n,b));c.length?this.c="":this.c||(this.c=a);this.cache&&this.j.set(a,c);return c};g.prototype.info=
|
||||||
q?1:0;t<h;t++){var w=k[t];if(w&&!p[w]){for(var x,y=!1,u=[],z=0,A=9;A>=f;A--)if(x=(q?l[v]:this.l)[A][w])u[z++]=x,y=!0;if(y)n[n.length]=1<z?n.concat.apply([],u):u[0];else{g=!1;break}p[w]="1"}v=w}else g=!1;g&&(c=Q(n,b));c.length?this.c="":this.c||(this.c=a);this.cache&&this.j.set(a,c);return c};g.prototype.info=function(){if(this.b)for(var a=0;a<this.b;a++)this.i[a].postMessage(a,{info:!0,id:this.id});else{for(var b,d,c=0,f=0,e=0,g=0;10>g;g++)for(b=Object.keys(this.l[g]),a=0;a<b.length;a++)d=this.l[g][b[a]].length,
|
function(){if(this.b)for(var a=0;a<this.b;a++)this.i[a].postMessage(a,{info:!0,id:this.id});else{for(var b,d,c=0,f=0,e=0,g=0;10>g;g++)for(b=Object.keys(this.l[g]),a=0;a<b.length;a++)d=this.l[g][b[a]].length,c+=d+2*b[a].length+4,f+=d,e+=2*b[a].length;b=Object.keys(this.a);d=b.length;for(a=0;a<d;a++)c+=2*b[a].length+2;return{id:this.id,memory:c,items:d,sequences:f,chars:e,status:this.u,cache:this.f.length,matcher:A.length,worker:this.b}}};g.prototype.reset=function(){this.destroy();return this.init()};
|
||||||
c+=d+2*b[a].length+4,f+=d,e+=2*b[a].length;b=Object.keys(this.a);d=b.length;for(a=0;a<d;a++)c+=2*b[a].length+2;return{id:this.id,memory:c,items:d,sequences:f,chars:e,status:this.u,cache:this.f.length,matcher:A.length,worker:this.b}}};g.prototype.reset=function(){this.destroy();return this.init()};g.prototype.destroy=function(){this.cache&&(this.j.reset(),this.j=null);this.B=this.F=this.l=this.o=this.a=this.h=this.f=null;return this};var z={icase:function(a){return a.toLowerCase()},simple:function(){var a=
|
g.prototype.destroy=function(){this.cache&&(this.j.reset(),this.j=null);this.filter=this.stemmer=this.l=this.o=this.a=this.h=this.f=null;return this};var z={icase:function(a){return a.toLowerCase()},simple:function(){var a=[e("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",e("[\u00e8\u00e9\u00ea\u00eb]"),"e",e("[\u00ec\u00ed\u00ee\u00ef]"),"i",e("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",e("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",e("[\u00fd\u0177\u00ff]"),"y",e("\u00f1"),"n",e("\u00e7"),"c",e("\u00df"),
|
||||||
[e("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",e("[\u00e8\u00e9\u00ea\u00eb]"),"e",e("[\u00ec\u00ed\u00ee\u00ef]"),"i",e("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",e("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",e("[\u00fd\u0177\u00ff]"),"y",e("\u00f1"),"n",e("\u00e7"),"c",e("\u00df"),"s",e(" & ")," and ",e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s\\s+")," "];return function(b){b=y(b.toLowerCase(),a);return" "!==b?b:""}}(),advanced:function(){var a=[e("ae"),"a",e("ai"),"ei",e("ay"),"ei",e("ey"),"ei",e("oe"),
|
"s",e(" & ")," and ",e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s\\s+")," "];return function(b){b=y(b.toLowerCase(),a);return" "!==b?b:""}}(),advanced:function(){var a=[e("ae"),"a",e("ai"),"ei",e("ay"),"ei",e("ey"),"ei",e("oe"),"o",e("ue"),"u",e("ie"),"i",e("sz"),"s",e("zs"),"s",e("sh"),"s",e("ck"),"k",e("cc"),"k",e("dt"),"t",e("ph"),"f",e("pf"),"f",e("ou"),"o",e("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=D(b));return b}}(),extra:function(){var a=
|
||||||
"o",e("ue"),"u",e("ie"),"i",e("sz"),"s",e("zs"),"s",e("sh"),"s",e("ck"),"k",e("cc"),"k",e("dt"),"t",e("ph"),"f",e("pf"),"f",e("ou"),"o",e("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=D(b));return b}}(),extra:function(){var a=[e("p"),"b",e("z"),"s",e("[cgq]"),"k",e("n"),"m",e("d"),"t",e("[vw]"),"f",e("[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];
|
[e("p"),"b",e("z"),"s",e("[cgq]"),"k",e("n"),"m",e("d"),"t",e("[vw]"),"f",e("[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=D(b)}return b}}(),balance:function(){var a=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s\\s+")," "];return function(b){return D(y(b.toLowerCase(),a))}}()},H=function(){var a={};return function(b,d,c){var e=a[c];e&&clearTimeout(e);
|
||||||
1<c.length&&(b[d]=c[0]+y(c.substring(1),a))}b=b.join(" ");b=D(b)}return b}}(),balance:function(){var a=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s\\s+")," "];return function(b){return D(y(b.toLowerCase(),a))}}()},H=function(){var a={};return function(b,d,c){var e=a[c];e&&clearTimeout(e);return a[c]=setTimeout(b,d)}}(),U=function(){function a(a){this.reset();this.A=!0!==a&&a}a.prototype.reset=function(){this.cache={};this.count={};this.index={};this.keys=[]};a.prototype.set=function(a,d){if(this.A&&"undefined"===
|
return a[c]=setTimeout(b,d)}}(),U=function(){function a(a){this.reset();this.A=!0!==a&&a}a.prototype.reset=function(){this.cache={};this.count={};this.index={};this.keys=[]};a.prototype.set=function(a,d){if(this.A&&"undefined"===typeof this.cache[a]){var b=this.keys.length;if(b===this.A){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=
|
||||||
typeof this.cache[a]){var b=this.keys.length;if(b===this.A){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.A&&b){var c=++this.count[a],e=this.index,g=e[a];if(0<g){for(var k=this.keys,h=g;this.count[k[--g]]<=c&&-1!==g;);g++;if(g!==h){for(c=h;c>g;c--)h=k[c-1],k[c]=h,e[h]=c;k[g]=a;e[a]=g}}}return b};return a}();
|
this.cache[a];if(this.A&&b){var c=++this.count[a],e=this.index,g=e[a];if(0<g){for(var k=this.keys,h=g;this.count[k[--g]]<=c&&-1!==g;);g++;if(g!==h){for(c=h;c>g;c--)h=k[c-1],k[c]=h,e[h]=c;k[g]=a;e[a]=g}}}return b};return a}();return g}(function(){var q={},B=!("undefined"===typeof Blob||"undefined"===typeof URL||!URL.createObjectURL);return function(g,t,e,y,u){var n=g;g=B?URL.createObjectURL(new Blob(["var SUPPORT_WORKER = true;var SUPPORT_BUILTINS = true;var SUPPORT_DEBUG = true;var SUPPORT_CACHE = true;var SUPPORT_ASYNC = true;("+
|
||||||
return g}(function(){var q={},B=!("undefined"===typeof Blob||"undefined"===typeof URL||!URL.createObjectURL);return function(g,t,e,y,u){var n=g;g=B?URL.createObjectURL(new Blob(["var SUPPORT_WORKER = true;var SUPPORT_BUILTINS = true;var SUPPORT_DEBUG = true;var SUPPORT_CACHE = true;var SUPPORT_ASYNC = true;("+e.toString()+")()"],{type:"text/javascript"})):"../"+n+".js";n+="-"+t;q[n]||(q[n]=[]);q[n][u]=new Worker(g);q[n][u].onmessage=y;console.log("Register Worker: "+n+"@"+u);return{postMessage:function(e,
|
e.toString()+")()"],{type:"text/javascript"})):"../"+n+".js";n+="-"+t;q[n]||(q[n]=[]);q[n][u]=new Worker(g);q[n][u].onmessage=y;console.log("Register Worker: "+n+"@"+u);return{postMessage:function(e,g){q[n][e].postMessage(g)}}}}()),this);
|
||||||
g){q[n][e].postMessage(g)}}}}()),this);
|
|
||||||
|
175
lang/de.js
Normal file
175
lang/de.js
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
/** @define {boolean} */
|
||||||
|
var SUPPORT_LANG_DE = true;
|
||||||
|
|
||||||
|
if(SUPPORT_LANG_DE) (function(root){
|
||||||
|
|
||||||
|
root['FlexSearch']['registerLanguage']('de', /** @const */ {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http://www.ranks.nl/stopwords
|
||||||
|
* @type {Array<string>}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
|
||||||
|
filter: [
|
||||||
|
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object<string, string>}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
|
||||||
|
stemmer: {
|
||||||
|
|
||||||
|
"niss": "",
|
||||||
|
"isch": "",
|
||||||
|
"lich": "",
|
||||||
|
"heit": "",
|
||||||
|
"keit": "",
|
||||||
|
"end": "",
|
||||||
|
"ung": "",
|
||||||
|
"est": "",
|
||||||
|
"ern": "",
|
||||||
|
"em": "",
|
||||||
|
"er": "",
|
||||||
|
"en": "",
|
||||||
|
"es": "",
|
||||||
|
"st": "",
|
||||||
|
"ig": "",
|
||||||
|
"ik": "",
|
||||||
|
"e": "",
|
||||||
|
"s": ""
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})(this);
|
2
lang/de.min.js
vendored
Normal file
2
lang/de.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
this.FlexSearch.registerLanguage("de",{filter:"aber als am an auch auf aus bei bin bis bist da dadurch daher darum das da\u00df 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\u00fcr hatte hatten hattest hattet hier hinter ich ihr ihre im in ist ja jede jedem jeden jeder jedes jener jenes jetzt kann kannst k\u00f6nnen k\u00f6nnt machen mein meine mit mu\u00df mu\u00dft musst m\u00fcssen m\u00fc\u00dft 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 \u00fcber".split(" "),
|
||||||
|
stemmer:{niss:"",isch:"",lich:"",heit:"",keit:"",end:"",ung:"",est:"",ern:"",em:"",er:"",en:"",es:"",st:"",ig:"",ik:"",e:"",s:""}});
|
279
lang/en.js
Normal file
279
lang/en.js
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
/** @define {boolean} */
|
||||||
|
var SUPPORT_LANG_EN = true;
|
||||||
|
|
||||||
|
if(SUPPORT_LANG_EN) (function(root){
|
||||||
|
|
||||||
|
root['FlexSearch']['registerLanguage']('en', /** @const */ {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http://www.ranks.nl/stopwords
|
||||||
|
* @type {Array<string>}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
|
||||||
|
filter: [
|
||||||
|
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object<string, string>}
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
|
||||||
|
stemmer: {
|
||||||
|
|
||||||
|
"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);
|
2
lang/en.min.js
vendored
Normal file
2
lang/en.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
this.FlexSearch.registerLanguage("en",{filter:"a about above after again against all also am an and any are aren't as at be because been before being below both but by can cannot can't come could couldn't did didn't do does doesn't doing dont down during each even few first for from further get go had hadn't has hasn't have haven't having he hed 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 make me more most mustn't my myself new no nor not now of off on once only or other ought our our's ourselves out over own same say see shan't she she'd shell shes should shouldn't so some such than that that's the their theirs them themselves then there there's these they they'd they'll they're they've this those through time to too until up us 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 would wouldn't you you'd you'll your you're your's yourself yourselves you've".split(" "),
|
||||||
|
stemmer:{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:""}});
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flexsearch",
|
"name": "flexsearch",
|
||||||
"version": "0.2.44",
|
"version": "0.2.461",
|
||||||
"description": "Next-Generation full text search library with zero dependencies.",
|
"description": "Next-Generation full text search library with zero dependencies.",
|
||||||
"homepage": "https://nextapps-de.github.io/xone/",
|
"homepage": "https://nextapps-de.github.io/xone/",
|
||||||
"author": "Thomas Wilkerling",
|
"author": "Thomas Wilkerling",
|
||||||
@@ -25,9 +25,10 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node compile RELEASE=min SUPPORT_DEBUG=true SUPPORT_WORKER=true SUPPORT_BUILTINS=true SUPPORT_CACHE=true SUPPORT_ASYNC=true && exit 0",
|
"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 SUPPORT_DEBUG=false SUPPORT_WORKER=false SUPPORT_BUILTINS=false SUPPORT_CACHE=false SUPPORT_ASYNC=false && exit 0",
|
"build-light": "node compile RELEASE=light && exit 0",
|
||||||
"build-custom": "node compile",
|
"build-custom": "node compile",
|
||||||
"build-all": "npm run build && npm run build-light",
|
"build-lang": "node compile RELEASE=lang && exit 0",
|
||||||
|
"build-all": "npm run build && npm run build-light && npm run build-lang",
|
||||||
"test-production": "nyc --reporter=html --reporter=text mocha --timeout=3000 test --exit",
|
"test-production": "nyc --reporter=html --reporter=text mocha --timeout=3000 test --exit",
|
||||||
"test-light": "nyc --reporter=html --reporter=text mocha --timeout=3000 test/ --exit",
|
"test-light": "nyc --reporter=html --reporter=text mocha --timeout=3000 test/ --exit",
|
||||||
"test-develop": "nyc --reporter=html --reporter=text mocha --timeout=3000 --exit",
|
"test-develop": "nyc --reporter=html --reporter=text mocha --timeout=3000 --exit",
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"flexsearch.js",
|
"flexsearch.js",
|
||||||
"flexsearch.min.js",
|
"flexsearch.min.js",
|
||||||
|
"lang/",
|
||||||
"test/"
|
"test/"
|
||||||
],
|
],
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
|
@@ -837,7 +837,7 @@ describe('Encoding', function(){
|
|||||||
|
|
||||||
it('Should have been encoded properly: Custom Encoder', function(){
|
it('Should have been encoded properly: Custom Encoder', function(){
|
||||||
|
|
||||||
FlexSearch.register('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"));
|
||||||
});
|
});
|
||||||
@@ -1006,7 +1006,7 @@ describe('Add Matchers', function(){
|
|||||||
|
|
||||||
it('Should have been added properly', function(){
|
it('Should have been added properly', function(){
|
||||||
|
|
||||||
FlexSearch.addMatcher({
|
FlexSearch.registerMatcher({
|
||||||
|
|
||||||
'1': 'a',
|
'1': 'a',
|
||||||
'2': 'b',
|
'2': 'b',
|
||||||
|
Reference in New Issue
Block a user