aboutsummaryrefslogtreecommitdiff
path: root/build-index.js
diff options
context:
space:
mode:
authorShotaro Aoki <ikoamu@gmail.com>2024-09-16 00:10:50 +0900
committerGitHub <noreply@github.com>2024-09-16 00:10:50 +0900
commitce8a263fa24644083ba7be508b6f6916b5f2b9a5 (patch)
treeeebd6291b1416916cac3c13e76a99646358f4f82 /build-index.js
parent3a618f8defb382a76e19c9255bb60262e12421f1 (diff)
parent2c6f5c08beaa73b9d166370a605f9b505f29b480 (diff)
Merge pull request #26 from thargosu/fuse_index
Fuse index
Diffstat (limited to 'build-index.js')
-rw-r--r--build-index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/build-index.js b/build-index.js
new file mode 100644
index 0000000..e8a8bae
--- /dev/null
+++ b/build-index.js
@@ -0,0 +1,11 @@
+// build-index.js
+
+const Fuse = require('fuse.js')
+const fs = require('fs')
+const data = require('./searchdata.json')
+
+// Create the Fuse index
+const myIndex = Fuse.createIndex(['tags', 'title', 'content'], data)
+
+// Serialize and save it
+fs.writeFileSync('fuse-index.json', JSON.stringify(myIndex.toJSON()))