# Indexing

# Fuse.createIndex

Pre-generate the index from the list, and pass it directly into the Fuse instance. If the list is (considerably) large, it speeds up instantiation.



Fuse will automatically index the table if one isn't provided during instantiation.

# Fuse.parseIndex

Parses a serialized Fuse index.


// (1) In the build step
// Create the Fuse index
const myIndex = Fuse.createIndex(['title', 'author.firstName'], books)
// Serialize and save it
fs.writeFile('fuse-index.json', JSON.stringify(myIndex.toJSON()))

// (2) When app starts
// Load and deserialize index
const fuseIndex = await require('fuse-index.json')
const myIndex = Fuse.parseIndex(fuseIndex)
// initialize Fuse with the index
const fuse = new Fuse(books, options, myIndex)
Last Updated: 1/2/2021, 12:25:17 PM