From d41fbc396821a16e8a84ee601bbc62e5bf2f8beb Mon Sep 17 00:00:00 2001 From: Sriharsha Chintalapani Date: Mon, 11 Aug 2025 10:21:41 -0700 Subject: [PATCH] =?UTF-8?q?The=20`searchQuery`=20function=20in=20the=20`se?= =?UTF-8?q?archAPI.ts`=20file=20was=20constructin=E2=80=A6=20(#22803)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The `searchQuery` function in the `searchAPI.ts` file was constructing an incorrect query when the search value was empty. This caused the API call to fail and the assets were not displayed in the glossary term's assets tab. This commit fixes the `searchQuery` function to correctly handle the case where the search value is empty. * fix playwright test --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Ashish Gupta --- .../src/main/resources/ui/playwright/utils/domain.ts | 2 +- .../src/main/resources/ui/src/rest/searchAPI.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/domain.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/domain.ts index 02bfec66c91..d89723afc98 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/domain.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/domain.ts @@ -386,7 +386,7 @@ export const addAssetsToDomain = async ( return ( response .url() - .includes('/api/v1/search/query?q=**&index=all&from=0&size=15') && + .includes('/api/v1/search/query?q=&index=all&from=0&size=15') && queryFilter !== null && queryFilter !== '' ); diff --git a/openmetadata-ui/src/main/resources/ui/src/rest/searchAPI.ts b/openmetadata-ui/src/main/resources/ui/src/rest/searchAPI.ts index 4fc276d89b7..6949cb659f2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/rest/searchAPI.ts +++ b/openmetadata-ui/src/main/resources/ui/src/rest/searchAPI.ts @@ -176,11 +176,12 @@ export const rawSearchQuery = < const queryWithSlash = getQueryWithSlash(query || ''); - const apiQuery = query - ? filters - ? `${queryWithSlash} AND ` - : queryWithSlash - : ''; + const apiQuery = + query && query !== '**' + ? filters + ? `${queryWithSlash} AND ` + : queryWithSlash + : ''; const apiUrl = `/search/query?q=${apiQuery}${filters ?? ''}`;