mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-09-09 13:41:13 +02:00
-- MOVED FROM MASTER --
This commit is contained in:
54
test/bm25/index.html
Normal file
54
test/bm25/index.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: bm25</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://gistcdn.githack.com/vlad-x/a25e0c5c1eeb6bf6aa38/raw/02d1a1703e4a99a7c733c85097f583579f6af4e2/bm25.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["bm25"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new BM25();
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
lib.addDocument({id: i, body: data[i]});
|
||||
}
|
||||
|
||||
lib.updateIdf();
|
||||
},
|
||||
update: function(id){
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
lib.addDocument({id: i, body: data[i]});
|
||||
}
|
||||
|
||||
lib.updateIdf();
|
||||
},
|
||||
remove: function(id){
|
||||
|
||||
// not implemented
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
51
test/bulksearch-match/index.html
Normal file
51
test/bulksearch-match/index.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: bulksearch-0.1.3</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/bulksearch@master/bulksearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["bulksearch"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new BulkSearch({
|
||||
|
||||
type: "short",
|
||||
encode: 'extra',
|
||||
multi: true
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
update: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.update(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query, { suggest: true });
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
54
test/bulksearch/index.html
Normal file
54
test/bulksearch/index.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: bulksearch-0.1.3</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/bulksearch@master/bulksearch.light.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["bulksearch"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new BulkSearch({
|
||||
|
||||
type: "short",
|
||||
encode: "icase",
|
||||
multi: false,
|
||||
async: false,
|
||||
cache: false,
|
||||
worker: false
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
update: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.update(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
50
test/elasticlunr/index.html
Normal file
50
test/elasticlunr/index.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: elasticlunr-0.9.6</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/gh/weixsong/elasticlunr.js@0.9.6/example/elasticlunr.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["elasticlunr"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = elasticlunr(function(){
|
||||
|
||||
this.addField("content");
|
||||
this.setRef("id");
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.addDoc({ id: i, content: data[i] });
|
||||
}
|
||||
},
|
||||
update: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.addDoc({ id: i, content: data[i] });
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query, { expand: true });
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
59
test/flexsearch-0.6.2/index.html
Normal file
59
test/flexsearch-0.6.2/index.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-0.6.2</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/0.6.22/dist/flexsearch.light.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-0.6.2"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch({
|
||||
|
||||
encode: "icase",
|
||||
tokenize: "strict",
|
||||
resolution: 9,
|
||||
threshold: 8,
|
||||
depth: 1
|
||||
});
|
||||
|
||||
window["lib"] = lib;
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
update: function(id){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
remove: function(id){
|
||||
|
||||
lib.remove(id);
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
59
test/flexsearch-0.6.3/index.html
Normal file
59
test/flexsearch-0.6.3/index.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-0.6.3</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/0.6.32/dist/flexsearch.light.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-0.6.3"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch({
|
||||
|
||||
encode: "icase",
|
||||
tokenize: "strict",
|
||||
resolution: 9,
|
||||
threshold: 8,
|
||||
depth: 1
|
||||
});
|
||||
|
||||
window["lib"] = lib;
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
update: function(id){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
remove: function(id){
|
||||
|
||||
lib.remove(id);
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
51
test/flexsearch-0.7.0-context/index.html
Normal file
51
test/flexsearch-0.7.0-context/index.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script type="module">
|
||||
|
||||
import Index from "../../../src/index.js";
|
||||
//import Document from "../../../src/document.js";
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-0.7.0-match"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new Index({ context: { depth: 2 } });
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query, 10, { suggest: true });
|
||||
},
|
||||
update: function(id){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.update(i, data[i]);
|
||||
}
|
||||
},
|
||||
remove: function(id){
|
||||
|
||||
lib.remove(id);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
57
test/flexsearch-0.7.0-match/index.html
Normal file
57
test/flexsearch-0.7.0-match/index.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script type="module">
|
||||
|
||||
import Index from "../../../src/index.js";
|
||||
//import Document from "../../../src/document.js";
|
||||
import { encode } from "../../../src/lang/latin/advanced.js";
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-0.7.0-match"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new Index({
|
||||
|
||||
encode: encode,
|
||||
tokenize: "reverse",
|
||||
resolution: 20
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query, 10, { suggest: true });
|
||||
},
|
||||
update: function(id){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.update(i, data[i]);
|
||||
}
|
||||
},
|
||||
remove: function(id){
|
||||
|
||||
lib.remove(id);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
68
test/flexsearch-0.7.0/index.html
Normal file
68
test/flexsearch-0.7.0/index.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../../dist/flexsearch.light.js"></script>
|
||||
<script type="module">
|
||||
|
||||
//import Index from "../../../src/index.js";
|
||||
//import Document from "../../../src/document.js";
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib, split = /[^a-z]+/;
|
||||
|
||||
suite["flexsearch-0.7.0"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch.Index({
|
||||
|
||||
encode: str => str.toLowerCase().split(split),
|
||||
tokenize: "strict",
|
||||
resolution: 1,
|
||||
minlength: 3,
|
||||
optimize: false,
|
||||
fastupdate: false,
|
||||
context: {
|
||||
depth: 1,
|
||||
bidirectional: false,
|
||||
resolution: 1
|
||||
}
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query, 9999);
|
||||
},
|
||||
update: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.update(i, data[i]);
|
||||
}
|
||||
},
|
||||
remove: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.remove(i, data[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
39
test/flexsearch-balance/index.html
Normal file
39
test/flexsearch-balance/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-balance"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch("balance");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
39
test/flexsearch-default/index.html
Normal file
39
test/flexsearch-default/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.light.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-default"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch();
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
52
test/flexsearch-doc/index.html
Normal file
52
test/flexsearch-doc/index.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-ctx"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch({
|
||||
|
||||
//encode: "icase",
|
||||
tokenize: "strict",
|
||||
threshold: 8,
|
||||
resolution: 9,
|
||||
depth: 1,
|
||||
doc: {
|
||||
id: "id",
|
||||
field: "content"
|
||||
}
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
lib.add({
|
||||
id: i,
|
||||
content: data[i]
|
||||
});
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
39
test/flexsearch-fast/index.html
Normal file
39
test/flexsearch-fast/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.light.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-fast"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch("fast");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
39
test/flexsearch-match/index.html
Normal file
39
test/flexsearch-match/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-match"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch("match");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
38
test/flexsearch-memory/index.html
Normal file
38
test/flexsearch-memory/index.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-memory"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch("memory");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
38
test/flexsearch-score/index.html
Normal file
38
test/flexsearch-score/index.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-score"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch("score");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
38
test/flexsearch-speed/index.html
Normal file
38
test/flexsearch-speed/index.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="../../dist/flexsearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["flexsearch-speed"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new FlexSearch("speed");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
lib.add(i, data[i]);
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
52
test/fuse-match/index.html
Normal file
52
test/fuse-match/index.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: fuse-3.3.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/gh/krisk/Fuse@3.3.0/dist/fuse.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["fuse"] = {
|
||||
|
||||
init: function(){},
|
||||
add: function(data){
|
||||
|
||||
const length = data.length;
|
||||
const payload = new Array(length);
|
||||
|
||||
for(let i = 0; i < length; i++){
|
||||
|
||||
payload[i] = {id: i, content: data[i]};
|
||||
}
|
||||
|
||||
lib = new Fuse(payload, {
|
||||
|
||||
keys: ['content'],
|
||||
id: 'id',
|
||||
shouldSort: true,
|
||||
threshold: 1,
|
||||
location: 0,
|
||||
distance: 100,
|
||||
findAllMatches: true,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1
|
||||
});
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
49
test/fuse/index.html
Normal file
49
test/fuse/index.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: fuse-3.3.0</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/gh/krisk/Fuse@3.3.0/dist/fuse.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["fuse"] = {
|
||||
|
||||
init: function(){},
|
||||
add: function(data){
|
||||
|
||||
const length = data.length;
|
||||
const payload = new Array(length);
|
||||
|
||||
for(let i = 0; i < length; i++){
|
||||
|
||||
payload[i] = {id: i, content: data[i]};
|
||||
}
|
||||
|
||||
lib = new Fuse(payload, {
|
||||
|
||||
keys: ["content"],
|
||||
id: "id",
|
||||
shouldSort: true,
|
||||
tokenize: true,
|
||||
matchAllTokens: true,
|
||||
threshold: 0.2
|
||||
});
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
33
test/fuzzysearch/index.html
Normal file
33
test/fuzzysearch/index.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: fuzzysearch</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://rawcdn.githack.com/jeancroy/FuzzySearch/cbcdd8307d70a209b1cbf17a535158d5c21840d7/dist/FuzzySearch.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["fuzzysearch"] = {
|
||||
|
||||
init: function(){},
|
||||
add: function(data){
|
||||
|
||||
lib = new FuzzySearch({source: data});
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
44
test/js-search/index.html
Normal file
44
test/js-search/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: js-search-1.4.2</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-search@1.4.2/dist/umd/js-search.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["js-search"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new JsSearch.Search("id");
|
||||
lib.addIndex("content");
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
const payload = [];
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
payload[i] = {id: i, content: data[i]};
|
||||
}
|
||||
|
||||
lib.addDocuments(payload);
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
48
test/jsii/index.html
Normal file
48
test/jsii/index.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: jsii</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<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 type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["jsii"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new JSii();
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
const payload = [];
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
payload[i] = {
|
||||
|
||||
id: i,
|
||||
text: data[i]
|
||||
};
|
||||
}
|
||||
|
||||
lib.feedDocs(payload);
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query).docs;
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
49
test/lunr/index.html
Normal file
49
test/lunr/index.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: lunr-2.3.5</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/lunr@2.3.5/lunr.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["lunr"] = {
|
||||
|
||||
init: function(){},
|
||||
add: function(data){
|
||||
|
||||
lib = lunr(function(){
|
||||
|
||||
this.ref("id");
|
||||
this.field("content");
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
this.add({
|
||||
|
||||
id: i,
|
||||
content: data[i]
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.query(function(q) {
|
||||
|
||||
q.term(query, { wildcard: lunr.Query.wildcard.LEADING })
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
52
test/lyra/index.html
Normal file
52
test/lyra/index.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: lyra-0.2.4</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
import { create, search, insert } from "https://unpkg.com/@lyrasearch/lyra@0.2.4/dist/esm/src/lyra.js";
|
||||
|
||||
let index;
|
||||
|
||||
suite["lyra"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
index = create({
|
||||
schema: {
|
||||
_id: "number",
|
||||
content: "string"
|
||||
},
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0, len = data.length; i < len; i++){
|
||||
|
||||
insert(index, {
|
||||
_id: i,
|
||||
content: data[i]
|
||||
});
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
const searchResult = search(index, {
|
||||
term: query,
|
||||
properties: ["content"]
|
||||
});
|
||||
|
||||
return searchResult.hits.map(hit => hit._id);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
42
test/minisearch-match/index.html
Normal file
42
test/minisearch-match/index.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: minisearch</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/minisearch@3.0.2/dist/umd/index.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["minisearch"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new MiniSearch({
|
||||
fields: ["text"],
|
||||
storeFields: ["id"]
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
lib.add({ id: i, text: data[i] });
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query, { prefix: true, fuzzy: 0.2 });
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
42
test/minisearch/index.html
Normal file
42
test/minisearch/index.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: minisearch</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/minisearch@3.0.2/dist/umd/index.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["minisearch"] = {
|
||||
|
||||
init: function(){
|
||||
|
||||
lib = new MiniSearch({
|
||||
fields: ["text"],
|
||||
storeFields: ["id"]
|
||||
});
|
||||
},
|
||||
add: function(data){
|
||||
|
||||
for(let i = 0; i < data.length; i++){
|
||||
|
||||
lib.add({ id: i, text: data[i] });
|
||||
}
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib.search(query);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
37
test/wade/index.html
Normal file
37
test/wade/index.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Benchmark</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Benchmark: wade-0.3.3</h2><hr/>
|
||||
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
|
||||
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
|
||||
<script src="https://cdn.jsdelivr.net/gh/kbrsh/wade@0.3.3/dist/wade.min.js"></script>
|
||||
<script type="module">
|
||||
|
||||
import { suite } from "../../bench.js";
|
||||
|
||||
let lib;
|
||||
|
||||
suite["wade"] = {
|
||||
|
||||
init: function(){},
|
||||
add: function(data){
|
||||
|
||||
lib = Wade(data);
|
||||
},
|
||||
query: function(query){
|
||||
|
||||
return lib(query).sort(function(a, b){
|
||||
|
||||
const sum = a.score - b.score;
|
||||
return sum < 0 ? 1 : sum ? -1 : 0;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user