summaryrefslogtreecommitdiff
path: root/includes/search/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'includes/search/index.js')
-rw-r--r--includes/search/index.js34
1 files changed, 0 insertions, 34 deletions
diff --git a/includes/search/index.js b/includes/search/index.js
deleted file mode 100644
index fb75e4e..0000000
--- a/includes/search/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const Fuse = require('fuse.js');
-const fs = require('fs');
-
-const entries = JSON.parse(fs.readFileSync(process.argv[2]).toString())["entries"];
-const query = JSON.parse(fs.readFileSync(process.argv[2]).toString())["query"];
-const allowExactMatch = JSON.parse(fs.readFileSync(process.argv[2]).toString())["exact"];
-
-let fuse = new Fuse(entries, {
- includeScore: true,
- findAllMatches: true,
- keys: [
- {
- name: "name",
- weight: 0.7
- },
- {
- name: "alts",
- weight: 0.5
- },
- {
- name: "extract",
- weight: 0.3
- }
- ]
-});
-
-let results = fuse.search(query);
-console.log(JSON.stringify(results.map(i => {
- return {
- score: i.score,
- breakdown: [],
- value: i.item
- }
-}).filter(i => allowExactMatch || (!allowExactMatch && i.value.name.toLowerCase() !== query.toLowerCase())))); \ No newline at end of file