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:
@@ -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);
|
||||
|
@@ -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;
|
||||
|
52
bench/test/lyra/index.html
Normal file
52
bench/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>
|
Reference in New Issue
Block a user