aboutsummaryrefslogtreecommitdiff
path: root/build-index.js
blob: e8a8baea3a44b5359cd66419f3cffd2a437b78b2 (plain)
1
2
3
4
5
6
7
8
9
10
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()))