« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/static/js/search-worker.js27
-rw-r--r--src/util/search-spec.js16
2 files changed, 38 insertions, 5 deletions
diff --git a/src/static/js/search-worker.js b/src/static/js/search-worker.js
index 44af94fd..ab7830c0 100644
--- a/src/static/js/search-worker.js
+++ b/src/static/js/search-worker.js
@@ -383,13 +383,30 @@ function performSearchAction({query, options}) {
 
 function queryGenericIndex(index, query, options) {
   const interestingFieldCombinations = [
-    ['primaryName', 'contributors', 'groups'],
-    ['primaryName', 'groups'],
-    ['kind', 'contributors', 'primaryName'],
-    ['kind', 'contributors', 'groups'],
-    ['kind', 'groups', 'primaryName'],
+    ['kind', 'primaryName', 'parentName', 'groups'],
+    ['kind', 'primaryName', 'parentName'],
+    ['kind', 'primaryName', 'groups', 'contributors'],
+    ['kind', 'primaryName', 'groups', 'artTags'],
+    ['kind', 'primaryName', 'groups'],
+    ['kind', 'primaryName', 'contributors'],
+    ['kind', 'parentName', 'groups', 'artTags'],
+    ['kind', 'parentName', 'artTags'],
+    ['kind', 'groups', 'contributors'],
+    ['kind', 'groups', 'artTags'],
     ['kind', 'groups'],
     ['kind', 'contributors'],
+
+    ['primaryName', 'parentName', 'groups'],
+    ['primaryName', 'parentName'],
+    ['primaryName', 'groups', 'contributors'],
+    ['primaryName', 'groups', 'artTags'],
+    ['primaryName', 'groups'],
+    ['primaryName', 'contributors'],
+    ['parentName', 'groups', 'artTags'],
+    ['parentName', 'artTags'],
+    ['groups', 'contributors'],
+    ['groups', 'artTags'],
+
     ['contributors', 'groups'],
     ['primaryName', 'contributors'],
     ['primaryName'],
diff --git a/src/util/search-spec.js b/src/util/search-spec.js
index a990d022..4d07019b 100644
--- a/src/util/search-spec.js
+++ b/src/util/search-spec.js
@@ -118,9 +118,23 @@ export const searchSpec = {
       fields.primaryName =
         thing.name;
 
+      fields.parentName =
+        (fields.kind === 'track'
+          ? thing.album.name
+       : fields.kind === 'group'
+          ? thing.category.name
+       : fields.kind === 'flash'
+          ? thing.act.name
+          : null);
+
       fields.color =
         thing.color;
 
+      fields.artTags =
+        (Object.hasOwn(thing, 'artTags')
+          ? thing.artTags.map(artTag => artTag.nameShort)
+          : []);
+
       fields.additionalNames =
         (Object.hasOwn(thing, 'additionalNames')
           ? thing.additionalNames.map(entry => entry.name)
@@ -173,6 +187,8 @@ export const searchSpec = {
     index: [
       'kind',
       'primaryName',
+      'parentName',
+      'artTags',
       'additionalNames',
       'contributors',
       'groups',