krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.05k stars 766 forks source link

Document Fuse's Index JSON format #479

Closed satyanash closed 3 years ago

satyanash commented 4 years ago

Description

There should be documentation for the serialized structure of the index, so that it may be generated by other programs not written in Javascript. This can be very useful in static site generators that can pre-generate the search index exactly once, simply to be consumed by Fuse on every page load.

Describe the solution you'd like

We already have this form of JSON serialization:

// 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()))

The JSON structure itself doesn't seem to be documented anywhere though.

Describe alternatives you've considered

For a workaround right now, we can call node in a subprocess to keep using Fuse during the generation. But this requires node, the Fuse package and other things.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days