From 2c6f5c08beaa73b9d166370a605f9b505f29b480 Mon Sep 17 00:00:00 2001 From: ThArGos Date: Fri, 13 Sep 2024 02:32:03 +0200 Subject: Build the index and copy it next to the search data --- build-index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 build-index.js (limited to 'build-index.js') 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())) -- cgit