The SearchIndexPlugin is responsible for generating the search index and configuration information for Fuse.js which is the matching engine powering the client-side search functionality of Mosaic sites.
It outputs 3 files:
- Full Search Index -
search-data.json - Condensed Search Index -
search-data-condensed.json - Search Configuration -
search-config.json
On a Mosaic site, the full index is fetched after a page has loaded, thus removing the chance of a huge index slowing down first-load.
Practically, the full index should load in the background before a user searches for something, but should a search be initiated before that (e.g., slow-internet) then the condensed version of the search index is available.
Search Index plugin creates a "condensed" version of the search index that only includes the title and route for each page. This is the "Minimum Viable Index" to provide somewhat useable search results client-side while the main search index is loaded in the background.
Any options that need to be passed to Fuse.js.
| Property | Description |
|---|---|
| includeScore | https://www.fusejs.io/api/options.html#includescore |
| includeMatches | https://www.fusejs.io/api/options.html#includematches |
| maxPatternLength | TODO |
| ignoreLocation | https://www.fusejs.io/api/options.html#ignorelocation |
| threshold | https://www.fusejs.io/api/options.html#threshold |
| keys | https://www.fusejs.io/api/options.html#keys |
This plugin runs with no special priority.
| Property | Description |
|---|---|
| maxLineLength | TODO |
| maxLineCount | TODO |
| keys | https://www.fusejs.io/api/options.html#keys |
| relevancy | search relevancy |
Add the following to the plugins collection:
It's usually a good idea to mark this plugin as disabled for preview sources otherwise the pages from the preview will appear in search results.