From d2d220e076d2bb250241f97dddda6c30be44978f Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Wed, 10 Apr 2024 04:37:11 +0200 Subject: [PATCH] migrated the search page as well --- webclient/components/AppSearchBar.vue | 14 ++++-- webclient/components/SearchResultItem.vue | 8 ++-- webclient/components/SearchSectionList.vue | 55 +++++----------------- webclient/pages/search.vue | 2 + 4 files changed, 26 insertions(+), 53 deletions(-) diff --git a/webclient/components/AppSearchBar.vue b/webclient/components/AppSearchBar.vue index 780b7b191..db4b1b918 100644 --- a/webclient/components/AppSearchBar.vue +++ b/webclient/components/AppSearchBar.vue @@ -105,9 +105,15 @@ function onKeyDown(e: KeyboardEvent): void { } const runtimeConfig = useRuntimeConfig(); -const url = computed( - () => `${runtimeConfig.public.apiURL}/api/search?q=${encodeURIComponent(query.value)}&lang=${locale.value}`, -); +const url = computed(() => { + const params = new URLSearchParams(); + params.append("q", query.value); + params.append("lang", locale.value); + params.append("pre_highlight", ""); + params.append("post_highlight", ""); + + return `${runtimeConfig.public.apiURL}/api/search?${params.toString()}`; +}); const { data, error, refresh } = await useFetch(url, {}); // a bit crude way of doing retries, but likely fine watchEffect(() => { @@ -172,7 +178,7 @@ watchEffect(() => { v-if="i < s.n_visible" :highlighted="e.id === highlighted" :item="e" - @click="searchGoTo(e.id, false)" + @click="searchBarFocused = false" @mousedown="keep_focus = true" @mouseover="highlighted = null" > diff --git a/webclient/components/SearchResultItem.vue b/webclient/components/SearchResultItem.vue index a2e7bb7cc..ca4beaf53 100644 --- a/webclient/components/SearchResultItem.vue +++ b/webclient/components/SearchResultItem.vue @@ -20,12 +20,10 @@ type RoomEntry = components["schemas"]["RoomEntry"];