From 9561db7b2549d7fe0696295f9a0d00c5230a0287 Mon Sep 17 00:00:00 2001
From: Matthias Mohr <m.mohr@uni-muenster.de>
Date: Thu, 7 Mar 2024 22:35:45 +0100
Subject: [PATCH] Clarify what we filter by

---
 src/components/Catalogs.vue | 10 +++++-----
 src/locales/de/texts.json   |  1 +
 src/locales/en/texts.json   |  1 +
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/components/Catalogs.vue b/src/components/Catalogs.vue
index b520b44e3..ae00e108d 100644
--- a/src/components/Catalogs.vue
+++ b/src/components/Catalogs.vue
@@ -6,7 +6,7 @@
       <ViewButtons class="mr-2" v-model="view" />
       <SortButtons v-if="isComplete && catalogs.length > 1" v-model="sort" />
     </header>
-    <SearchBox v-if="isComplete && catalogs.length > 1" class="mt-1 mb-1" v-model="searchTerm" :placeholder="$t('catalogs.filterByTitle')" />
+    <SearchBox v-if="isComplete && catalogs.length > 1" class="mt-1 mb-1" v-model="searchTerm" :placeholder="filterPlaceholder" />
     <Pagination ref="topPagination" v-if="showPagination" :pagination="pagination" placement="top" @paginate="paginate" />
     <b-alert v-if="searchTerm && catalogView.length === 0" variant="warning" show>{{ $t('catalogs.noMatches') }}</b-alert>
     <section class="list">
@@ -102,6 +102,9 @@ export default {
     isComplete() {
       return !this.hasMore && !this.showPagination;
     },
+    filterPlaceholder() {
+      return this.isComplete ? this.$t('catalogs.filterByTitleAndMore') : this.$t('catalogs.filterByTitle');
+    },
     showPagination() {
       // Check whether any pagination links are available
       return Object.values(this.pagination).some(link => !!link);
@@ -118,15 +121,12 @@ export default {
       if (this.searchTerm) {
         catalogs = catalogs.filter(catalog => {
           let haystack = [ catalog.title ];
-          if (catalog instanceof STAC) {
+          if (catalog instanceof STAC && this.isComplete) {
             haystack.push(catalog.id);
             if (Array.isArray(catalog.keywords)) {
               haystack = haystack.concat(catalog.keywords);
             }
           }
-          else {
-            haystack.push(catalog.href);
-          }
           return Utils.search(this.searchTerm, haystack);
         });
       }
diff --git a/src/locales/de/texts.json b/src/locales/de/texts.json
index fb93e42a9..93546f691 100644
--- a/src/locales/de/texts.json
+++ b/src/locales/de/texts.json
@@ -47,6 +47,7 @@
   },
   "catalogs": {
     "filterByTitle": "Kataloge anhand des Titels filtern",
+    "filterByTitleAndMore": "Kataloge anhand von Titel, Beschreibung oder Schlüsselwörtern filtern",
     "loadMore": "Lade mehr...",
     "noMatches": "Keiner der Kataloge entspricht den Suchkriterien."
   },
diff --git a/src/locales/en/texts.json b/src/locales/en/texts.json
index dc8c40481..8e2bb17dd 100644
--- a/src/locales/en/texts.json
+++ b/src/locales/en/texts.json
@@ -47,6 +47,7 @@
   },
   "catalogs": {
     "filterByTitle": "Filter catalogs by title",
+    "filterByTitleAndMore": "Filter catalogs by title, description or keywords",
     "loadMore": "Load more...",
     "noMatches": "No catalogs match the given search criteria."
   },