diff options
author | Gio <sethg@ipi.org> | 2024-03-26 18:35:21 -0500 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-31 12:11:45 -0300 |
commit | fcc45e386df65c68969391c7b113b6232c76c82a (patch) | |
tree | 938d6bf09104490b47ea335896d0534e21b3cbe1 /src/search.js | |
parent | f0d003c5b33affcc4c25b06b0f0e77a2b267e6a2 (diff) |
search: tidying, fix client
Diffstat (limited to 'src/search.js')
-rw-r--r-- | src/search.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/search.js b/src/search.js index 7dcf5cf9..cb4db7bb 100644 --- a/src/search.js +++ b/src/search.js @@ -30,7 +30,7 @@ export async function writeSearchIndex({ tracks: new FlexSearch.Document({ id: "reference", - index: ["track", "album", "artists", "directory", "additionalNames"], + index: ["name", "album", "artists", "directory", "additionalNames"], }), artists: new FlexSearch.Document({ @@ -50,7 +50,7 @@ export async function writeSearchIndex({ indexes.tracks.add({ reference: Thing.getReference(track), album: album.name, - track: track.name, + name: track.name, artists: [ track.artistContribs.map(contrib => contrib.artist.name), @@ -75,14 +75,15 @@ export async function writeSearchIndex({ } // Export indexes to json - const searchData = {} + const searchData = {}; + // Map each index to an export promise, and await all. await Promise.all( Object.entries(indexes) .map(([indexName, index]) => { searchData[indexName] = {}; return index.export((key, data) => { - searchData[indexName][key] = data + searchData[indexName][key] = data; }); })); |