« get me outta code hell

search: refactor search spec definition & interfaces - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-03 16:26:43 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:49 -0300
commit39fc3d74b1e7e193442ab77962935fb50a593c5d (patch)
tree963dbeffaa29b0c8b2ebcb7999768dbdbe81d29f /src/static
parentd5ec0affefaaa3c1d73a6abcfa6a3aa6abc703e4 (diff)
search: refactor search spec definition & interfaces
Diffstat (limited to 'src/static')
-rw-r--r--src/static/js/search-worker.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/static/js/search-worker.js b/src/static/js/search-worker.js
index 166be2a2..0b3c8cc5 100644
--- a/src/static/js/search-worker.js
+++ b/src/static/js/search-worker.js
@@ -1,4 +1,4 @@
-import {makeSearchIndexes} from '../shared-util/searchSchema.js';
+import {makeSearchIndex, searchSpec} from '../shared-util/search-spec.js';
 import {withEntries} from '../shared-util/sugar.js';
 
 import FlexSearch from '../lib/flexsearch/flexsearch.bundle.module.min.js';
@@ -21,7 +21,11 @@ main().then(
 
 async function main() {
   indexes =
-    makeSearchIndexes(FlexSearch);
+    withEntries(searchSpec, entries => entries
+      .map(([key, descriptor]) => [
+        key,
+        makeSearchIndex(descriptor, {FlexSearch}),
+      ]));
 
   searchData =
     await fetch('/search-data/index.json')