1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-09 21:50:49 +02:00

add lyra to benchmark comparison

This commit is contained in:
Thomas Wilkerling
2022-10-03 13:00:46 +02:00
parent a26cd5398f
commit 2e7eeeb7d5
3 changed files with 54 additions and 2 deletions

View File

@@ -24,7 +24,7 @@
/*"flexsearch-0.6.2", "flexsearch-0.6.3",*/ "minisearch", "flexsearch-0.7.0",
"bm25", "bulksearch", "elasticlunr",
"fuzzysearch", "js-search", "jsii",
"fuse", "lunr", "wade"
"fuse", "lunr", "wade", "lyra"
]);
list.render(lib);

View File

@@ -11,7 +11,7 @@ const lib = encode ? [
/*"flexsearch-0.6.2", "flexsearch-0.6.3",*/ "flexsearch-0.7.0-match",
"bm25", "bulksearch-match", "elasticlunr",
"fuzzysearch", "js-search", "jsii",
"minisearch-match", "fuse-match", "lunr", "wade"
"minisearch-match", "fuse-match", "lunr", "wade", "lyra"
];
let promise;

View 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>