aboutsummaryrefslogtreecommitdiff
path: root/build-index.js
diff options
context:
space:
mode:
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()))