« get me outta code hell

search, upd8: share schema between client and upd8 code - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client.js
diff options
context:
space:
mode:
authorGio <sethg@ipi.org>2024-03-26 20:08:52 -0500
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:45 -0300
commitc364e42237493bf8985da23fdc394df735fe6c3f (patch)
treeeed0a569dcdb7731a8f804ded8fc41ee75c3d5e3 /src/static/js/client.js
parentfcc45e386df65c68969391c7b113b6232c76c82a (diff)
search, upd8: share schema between client and upd8 code
Diffstat (limited to 'src/static/js/client.js')
-rw-r--r--src/static/js/client.js21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js
index 075448a8..650a3925 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -7,6 +7,9 @@
 
 import {accumulateSum, atOffset, empty, filterMultipleArrays, stitchArrays}
   from '../shared-util/sugar.js';
+
+import FlexSearch from '../lib/flexsearch/flexsearch.bundle.module.min.js';
+
 import {fetchWithProgress} from './xhr-util.js';
 
 const clientInfo = window.hsmusicClientInfo = Object.create(null);
@@ -3419,25 +3422,9 @@ clientSteps.addPageListeners.push(addArtistExternalLinkTooltipPageListeners);
 // Internal search functionality --------------------------
 
 async function initSearch() {
-  const {FlexSearch} = window;
 
   // Copied directly from server search.js
-  const indexes = {
-    albums: new FlexSearch.Document({
-      id: "reference",
-      index: ["name", "groups"],
-    }),
-
-    tracks: new FlexSearch.Document({
-      id: "reference",
-      index: ["name", "album", "artists", "directory", "additionalNames"],
-    }),
-
-    artists: new FlexSearch.Document({
-      id: "reference",
-      index: ["names"],
-    }),
-  };
+  const indexes = makeSearchIndexes(FlexSearch);
 
   window.indexes = indexes;