diff options
-rw-r--r-- | src/search.js | 25 | ||||
-rw-r--r-- | src/util/searchSchema.js | 10 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/search.js b/src/search.js index b83bb0e0..2f7718fd 100644 --- a/src/search.js +++ b/src/search.js @@ -86,6 +86,31 @@ async function populateSearchIndexes(indexes, wikiData) { }) ); + // Groups + readCollectionIntoIndex( + wikiData.groupData, + indexes.groups, + group => ({ + names: group.name, + description: group.description, + // category: group.category + }) + ); + + // Flashes + readCollectionIntoIndex( + wikiData.flashData, + indexes.flashes, + flash => ({ + name: flash.name, + tracks: flash.featuredTracks.map(track => track.name), + contributors: [ + flash.contributorContribs.map(contrib => contrib.artist.name), + ...flash.contributorContribs.map(contrib => contrib.artist.aliasNames) + ].flat() + }) + ); +} async function exportIndexesToJson(indexes) { const searchData = {}; diff --git a/src/util/searchSchema.js b/src/util/searchSchema.js index a4604dd4..ce0e7a84 100644 --- a/src/util/searchSchema.js +++ b/src/util/searchSchema.js @@ -16,6 +16,16 @@ export function makeSearchIndexes(FlexSearch) { id: "reference", index: ["names"], }), + + groups: new FlexSearch.Document({ + id: "reference", + index: ["name", "description", "category"], + }), + + flashes: new FlexSearch.Document({ + id: "reference", + index: ["name", "tracks", "contributors"], + }), }; return indexes; |