From 79cce06793870620c52626aafbd5435aab827275 Mon Sep 17 00:00:00 2001 From: pamfilos Date: Thu, 31 Oct 2024 13:21:21 +0100 Subject: [PATCH] ui: search update query to API Signed-off-by: pamfilos --- ui/src/types.ts | 1 + ui/src/utils/utils.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ui/src/types.ts b/ui/src/types.ts index 6c1b18926..013efe031 100644 --- a/ui/src/types.ts +++ b/ui/src/types.ts @@ -14,6 +14,7 @@ export type Params = { page?: number; page_size?: number; search?: string; + search_simple_query_string?: string; country?: string | string[]; journal?: string | string[]; publication_year__range?: string; diff --git a/ui/src/utils/utils.tsx b/ui/src/utils/utils.tsx index f87a1c3cd..94d7348e3 100644 --- a/ui/src/utils/utils.tsx +++ b/ui/src/utils/utils.tsx @@ -19,6 +19,9 @@ export const authToken = Token const buildSearchParams = (q: Params): string => { const searchParams = new URLSearchParams(); + // replace 'search' param with 'search_simple_query_string' + if (q["search"]) q['search_simple_query_string'] = q["search"]; + Object.entries(q).forEach(([key, value]) => { if (Array.isArray(value)) { value.forEach(item => searchParams.append(key, item));