« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/searchSchema.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/searchSchema.js')
-rw-r--r--src/util/searchSchema.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/searchSchema.js b/src/util/searchSchema.js
new file mode 100644
index 00000000..99ba869a
--- /dev/null
+++ b/src/util/searchSchema.js
@@ -0,0 +1,22 @@
+// Index structures shared by client and server.
+
+export function makeSearchIndexes(FlexSearch) {
+  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"],
+    }),
+  };
+
+  return indexes;
+}