« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/search.js')
-rw-r--r--src/search.js20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/search.js b/src/search.js
index cb4db7bb..9b5d2d7a 100644
--- a/src/search.js
+++ b/src/search.js
@@ -8,6 +8,8 @@ import FlexSearch from 'flexsearch';
 import {logError, logInfo, logWarn} from '#cli';
 import Thing from '#thing';
 
+import {makeSearchIndexes} from './util/searchSchema.js';
+
 export async function writeSearchIndex({
   wikiCachePath,
   wikiData,
@@ -21,23 +23,7 @@ export async function writeSearchIndex({
   // 2. Add documents to index
   // 3. Save index to exportable json
 
-  // Copy this block directly into clientSearch.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);
 
   for (const album of wikiData.albumData) {
     indexes.albums.add({