diff options
author | ThArGos <thargos@gmail.com> | 2024-09-13 02:32:03 +0200 |
---|---|---|
committer | ThArGos <thargos@gmail.com> | 2024-09-15 14:52:30 +0200 |
commit | 2c6f5c08beaa73b9d166370a605f9b505f29b480 (patch) | |
tree | eebd6291b1416916cac3c13e76a99646358f4f82 /build-index.js | |
parent | e41a5a995d258fadb88c0ec380898233b2f402d4 (diff) |
Build the index and copy it next to the search data
Diffstat (limited to 'build-index.js')
-rw-r--r-- | build-index.js | 11 |
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())) |