From 846dd2957e0d999a76057ea98d1b55645830a46a Mon Sep 17 00:00:00 2001 From: Nils Windisch <windisch@sub.uni-goettingen.de> Date: Tue, 3 Aug 2021 15:30:01 +0200 Subject: [PATCH] feat: hits per sheet optimisation --- src/.vuepress/components/SearchPage.vue | 6 ++++-- src/.vuepress/components/SearchResultList.vue | 21 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/.vuepress/components/SearchPage.vue b/src/.vuepress/components/SearchPage.vue index 24ab21b..da08721 100644 --- a/src/.vuepress/components/SearchPage.vue +++ b/src/.vuepress/components/SearchPage.vue @@ -1,11 +1,13 @@ <template> <div> <SearchInput @search="onSearchInput" /> + <!-- #TODO: add translation --> <p v-if="total > 0" - class="text-overline mb-0" - >{{total}} Results</p> + class="" + >Found a total of <code class="font-weight-black">{{total}}</code> Hits for <code class="font-weight-black">[search string]</code> in <code class="font-weight-black">[Count distinct Sheets]</code> Sheets and <code class="font-weight-black">[Count distinct Manifests]</code> Manifests.</p> <SearchResultList :items="items" /> + <!-- #TODO: show pagination only if there is more than 1 page --> <div class="text-center"> <v-pagination v-if="items.length > 0" diff --git a/src/.vuepress/components/SearchResultList.vue b/src/.vuepress/components/SearchResultList.vue index 55a4c57..1a33f51 100644 --- a/src/.vuepress/components/SearchResultList.vue +++ b/src/.vuepress/components/SearchResultList.vue @@ -5,19 +5,24 @@ subheader v-if="items.length > 0" > - <v-list-item v-for="item in items" :key="item.item" class="pl-0"> + <v-list-item v-for="item in items" :key="item.item" class="pl-0 mb-1"> <v-list-item-content> <a :href="getItemUrl(item)" target="_blank"> - <v-list-item-title>{{item.label}}</v-list-item-title> - <v-list-item-subtitle class="d-flex"> - <span v-for="(matchItem, i) in item.matches" class="d-flex"> - <span>"{{matchItem.match}}"</span> - <span> ({{matchItem.occurrencesOnPage}})</span> + <v-list-item-title class="mb-2"><span class="font-weight-regular">Sheet {{item.n}}</span> <span class="font-weight-light">in</span> <span class="font-weight-regular">{{item.label}}</span></v-list-item-title> + <v-list-item-subtitle class="d-flex mb-1"> + <span v-for="(matchItem, i) in item.matches" class="d-flex mb-1"> + <!-- + #TODO: adjust "Hit" to be singular or plural according to count of hits + --> + <span>{{matchItem.occurrencesOnPage}} Hits for <code>{{matchItem.match}}</code></span> <span v-if="i < item.matches.length - 1">, </span> </span> - <span class="ml-1">in Sheet {{item.n}}</span> + <!-- #TODO: add translation --> + <!--<span class="ml-1">in Sheet {{item.n}}</span>--> </v-list-item-subtitle> - <v-list-item-subtitle>{{getLanguage(item.lang)}}</v-list-item-subtitle> + <!-- #TODO: add translation --> + <!--<v-list-item-subtitle>Manifest: {{item.label}}</v-list-item-subtitle>--> + <v-list-item-subtitle>{{getLanguage(item.lang)}} Edition</v-list-item-subtitle> </a> </v-list-item-content> </v-list-item> -- GitLab