From f6b15ef2da339983f12b48bba009eaa14a39d4f2 Mon Sep 17 00:00:00 2001 From: Siddhant Date: Fri, 24 Apr 2026 15:42:53 +0530 Subject: [PATCH] fix(ui): match Tier/Certification tag FQNs by prefix, not substring (#27689) Closes #27689 `getTagAssetsQueryFilter` used `fqn.includes('Tier.')` / `.includes('Certification.')` to pick which index field to query, so any tag whose classification name *ended* with "Tier" or "Certification" (e.g. `DataTier.Bronze`) was routed to the `tier.tagFQN` / `certification.tagLabel.tagFQN` fields and returned no assets. Anchor the check to the start of the FQN using `FQN_SEPARATOR_CHAR` so only the built-in Tier and Certification classifications hit the special fields. --- .../resources/ui/src/utils/TagsUtils.test.tsx | 16 ++++++++++++++++ .../main/resources/ui/src/utils/TagsUtils.tsx | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.test.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.test.tsx index e37de5fea05a..f492090460d6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.test.tsx @@ -114,4 +114,20 @@ describe('getTagAssetsQueryFilter', () => { expect(result).toEqual(queryFilter); }); + + it('returns common query filter when classification name ends with "Tier"', () => { + const tagFQN = 'DataTier.Bronze'; + const result = getTagAssetsQueryFilter(tagFQN); + const queryFilter = getTermQuery({ 'tags.tagFQN': tagFQN }); + + expect(result).toEqual(queryFilter); + }); + + it('returns common query filter when classification name ends with "Certification"', () => { + const tagFQN = 'DataCertification.Gold'; + const result = getTagAssetsQueryFilter(tagFQN); + const queryFilter = getTermQuery({ 'tags.tagFQN': tagFQN }); + + expect(result).toEqual(queryFilter); + }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx index 4d98d9e34320..c91b413d53ab 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/TagsUtils.tsx @@ -597,9 +597,9 @@ export const getExcludedIndexesBasedOnEntityTypeEditTagPermission = ( export const getTagAssetsQueryFilter = (fqn: string) => { let fieldName = 'tags.tagFQN'; - if (fqn.includes('Tier.')) { + if (fqn.startsWith(`Tier${FQN_SEPARATOR_CHAR}`)) { fieldName = 'tier.tagFQN'; - } else if (fqn.includes('Certification.')) { + } else if (fqn.startsWith(`Certification${FQN_SEPARATOR_CHAR}`)) { fieldName = 'certification.tagLabel.tagFQN'; }