mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-09-01 01:51:57 +02:00
Add fuzzysearch to comparison
This commit is contained in:
@@ -45,19 +45,19 @@ Get Latest (Stable Release):
|
||||
<tr>
|
||||
<td>flexsearch.min.js</td>
|
||||
<td><a href="https://github.com/nextapps-de/flexsearch/raw/master/dist/flexsearch.min.js" target="_blank">Download</a></td>
|
||||
<td><a href="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.min.js" target="_blank">https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.min.js</a></td>
|
||||
<td><a href="https://rawcdn.githack.com/nextapps-de/flexsearch/8a4c8f849d8f78deed08e2d78c7400c27297deb6/dist/flexsearch.min.js" target="_blank">https://rawcdn.githack.com/nextapps-de/flexsearch/8a4c8f849d8f78deed08e2d78c7400c27297deb6/dist/flexsearch.min.js</a></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td>flexsearch.light.js</td>
|
||||
<td><a href="https://github.com/nextapps-de/flexsearch/raw/master/dist/flexsearch.light.js" target="_blank">Download</a></td>
|
||||
<td><a href="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.light.js" target="_blank">https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.light.js</a></td>
|
||||
<td><a href="https://rawcdn.githack.com/nextapps-de/flexsearch/8a4c8f849d8f78deed08e2d78c7400c27297deb6/dist/flexsearch.light.js" target="_blank">https://rawcdn.githack.com/nextapps-de/flexsearch/8a4c8f849d8f78deed08e2d78c7400c27297deb6/dist/flexsearch.light.js</a></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td>flexsearch.compact.js</td>
|
||||
<td><a href="https://github.com/nextapps-de/flexsearch/raw/master/dist/flexsearch.compact.js" target="_blank">Download</a></td>
|
||||
<td><a href="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.compact.js" target="_blank">https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.compact.js</a></td>
|
||||
<td><a href="https://rawcdn.githack.com/nextapps-de/flexsearch/8a4c8f849d8f78deed08e2d78c7400c27297deb6/dist/flexsearch.compact.js" target="_blank">https://rawcdn.githack.com/nextapps-de/flexsearch/8a4c8f849d8f78deed08e2d78c7400c27297deb6/dist/flexsearch.compact.js</a></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
|
@@ -3967,9 +3967,9 @@
|
||||
"var SUPPORT_INFO = " + (SUPPORT_INFO ? "true" : "false") + ";" +
|
||||
"var SUPPORT_DOCUMENT = " + (SUPPORT_DOCUMENT ? "true" : "false") + ";" +
|
||||
"var SUPPORT_WHERE = " + (SUPPORT_WHERE ? "true" : "false") + ";" +
|
||||
"var SUPPORT_WHERE = " + (SUPPORT_PAGINATION ? "true" : "false") + ";" +
|
||||
"var SUPPORT_WHERE = " + (SUPPORT_OPERATOR ? "true" : "false") + ";" +
|
||||
"var SUPPORT_WHERE = " + (SUPPORT_CALLBACK ? "true" : "false") + ";" +
|
||||
"var SUPPORT_PAGINATION = " + (SUPPORT_PAGINATION ? "true" : "false") + ";" +
|
||||
"var SUPPORT_OPERATOR = " + (SUPPORT_OPERATOR ? "true" : "false") + ";" +
|
||||
"var SUPPORT_CALLBACK = " + (SUPPORT_CALLBACK ? "true" : "false") + ";" +
|
||||
"var SUPPORT_WORKER = true;"
|
||||
|
||||
) + "(" + _worker.toString() + ")()"
|
||||
|
@@ -31,7 +31,8 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-search@1.4.2/dist/umd/js-search.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/karussell/jsii@master/web/js/src/BitSet.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/karussell/jsii@master/web/js/src/JSii.js"></script>
|
||||
<script src="https://gist.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script src="https://gistcdn.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script src="https://rawcdn.githack.com/jeancroy/FuzzySearch/cbcdd8307d70a209b1cbf17a535158d5c21840d7/dist/FuzzySearch.min.js"></script>
|
||||
<script src="../data/movies.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -49,6 +50,7 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
var jssearch;
|
||||
var jsii;
|
||||
var bm25;
|
||||
var fuzzysearch;
|
||||
|
||||
var tests = {
|
||||
|
||||
@@ -333,6 +335,20 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
return bm25.search(query);
|
||||
},
|
||||
loops: 50
|
||||
},
|
||||
|
||||
fuzzysearch: {
|
||||
|
||||
init: function(){
|
||||
|
||||
fuzzysearch = new FuzzySearch({source:data.slice(0)});
|
||||
},
|
||||
add: function(index, content){},
|
||||
query: function(query){
|
||||
|
||||
return fuzzysearch.search(query);
|
||||
},
|
||||
loops: 4
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -31,7 +31,8 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-search@1.4.2/dist/umd/js-search.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/karussell/jsii@master/web/js/src/BitSet.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/karussell/jsii@master/web/js/src/JSii.js"></script>
|
||||
<script src="https://gist.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script src="https://gistcdn.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script src="https://rawcdn.githack.com/jeancroy/FuzzySearch/cbcdd8307d70a209b1cbf17a535158d5c21840d7/dist/FuzzySearch.min.js"></script>
|
||||
<script src="../data/gulliver.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -49,6 +50,7 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
var jssearch;
|
||||
var jsii;
|
||||
var bm25;
|
||||
var fuzzysearch;
|
||||
|
||||
var tests = {
|
||||
|
||||
@@ -329,6 +331,20 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
return bm25.search(query);
|
||||
},
|
||||
loops: 95
|
||||
},
|
||||
|
||||
fuzzysearch: {
|
||||
|
||||
init: function(){
|
||||
|
||||
fuzzysearch = new FuzzySearch({source:text_data.slice(0)});
|
||||
},
|
||||
add: function(index, content){},
|
||||
query: function(query){
|
||||
|
||||
return fuzzysearch.search(query);
|
||||
},
|
||||
loops: 4
|
||||
}
|
||||
};
|
||||
|
||||
@@ -369,9 +385,9 @@ Test rules: 1. no cache allowed, 2. no async allowed, 3. should return at least
|
||||
|
||||
test.init();
|
||||
|
||||
if(is_mobile && (test.loops > 1)){
|
||||
if(is_mobile){
|
||||
|
||||
test.loops = (test.loops / 5) >> 0;
|
||||
test.loops = Math.max((test.loops / 5) >> 0, 1);
|
||||
}
|
||||
|
||||
for(var i = 0; i < text_data.length; i++){
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Presets Matching Test</title>
|
||||
<title>Presets Scoring Comparison</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: sans-serif;
|
||||
@@ -13,7 +13,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Presets Relevance Scoring Comparison</h2>
|
||||
<h2>Presets Scoring Comparison</h2>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<hr>
|
||||
<script src="../dist/flexsearch.min.js"></script>
|
||||
@@ -25,9 +25,9 @@
|
||||
<th>default</th>
|
||||
<th>memory</th>
|
||||
<th>speed</th>
|
||||
<th>matching</th>
|
||||
<th>scoring</th>
|
||||
<th>balanced</th>
|
||||
<th>match</th>
|
||||
<th>score</th>
|
||||
<th>balance</th>
|
||||
<th>fast</th>
|
||||
</tr>
|
||||
<tr id="test-1">
|
||||
|
@@ -29,6 +29,7 @@
|
||||
<th>jssearch</th>
|
||||
<th>jsii</th>
|
||||
<th>bm25</th>
|
||||
<th>fuzzysearch</th>
|
||||
</tr>
|
||||
<tr id="test-1">
|
||||
<td style="width: 200px"></td>
|
||||
@@ -41,6 +42,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-2">
|
||||
<td></td>
|
||||
@@ -53,6 +55,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-3">
|
||||
<td></td>
|
||||
@@ -65,6 +68,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-4">
|
||||
<td></td>
|
||||
@@ -77,6 +81,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-5">
|
||||
<td></td>
|
||||
@@ -89,6 +94,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-6">
|
||||
<td></td>
|
||||
@@ -101,6 +107,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-7">
|
||||
<td></td>
|
||||
@@ -113,6 +120,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-8">
|
||||
<td></td>
|
||||
@@ -125,6 +133,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-9">
|
||||
<td></td>
|
||||
@@ -137,6 +146,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-10">
|
||||
<td></td>
|
||||
@@ -149,6 +159,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-11">
|
||||
<td></td>
|
||||
@@ -161,6 +172,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr id="test-12">
|
||||
<td></td>
|
||||
@@ -173,6 +185,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="10">
|
||||
@@ -191,6 +204,7 @@
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
<td>wait ...</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -210,7 +224,8 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-search@1.3.7/dist/umd/js-search.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/karussell/jsii@master/web/js/src/BitSet.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/karussell/jsii@master/web/js/src/JSii.js"></script>
|
||||
<script src="https://gist.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script src="https://gistcdn.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script src="https://rawcdn.githack.com/jeancroy/FuzzySearch/cbcdd8307d70a209b1cbf17a535158d5c21840d7/dist/FuzzySearch.min.js"></script>
|
||||
<script src="../data/gulliver.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -254,6 +269,7 @@
|
||||
var jssearch;
|
||||
var jsii;
|
||||
var bm25;
|
||||
var fuzzysearch;
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
@@ -401,6 +417,12 @@
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
console.time('fuzzysearch');
|
||||
fuzzysearch = new FuzzySearch({source:data.slice(0)});
|
||||
console.timeEnd('fuzzysearch');
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
do_test('test-1', 'without breach of modesty', [493]);
|
||||
do_test('test-2', 'went softly stream', [446]);
|
||||
do_test('test-3', 'princes of the ambition', [72, 408]);
|
||||
@@ -464,6 +486,14 @@
|
||||
case 9:
|
||||
results = bm25.search(query).map(function(val){return val.id});
|
||||
break;
|
||||
|
||||
case 10:
|
||||
results = fuzzysearch.search(query).map(function(val){
|
||||
for(var i = 0; i < data.length; i++){
|
||||
if(val === data[i]) return i;
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
for(var a = 0; a < ref.length; a++){
|
||||
|
Reference in New Issue
Block a user