Fix #21653 - Tag search based on displayName (#21722)

* Fix #21653 - Tag search based on displayName

* added test

* update test to search by classification display name

---------

Co-authored-by: shrushti2000 <shrushtipolekar@gmail.com>
This commit is contained in:
sonika-shah 2025-06-13 03:18:14 +05:30 committed by GitHub
parent 66d2ef2c8b
commit 6fd5778219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 53 additions and 0 deletions

View File

@ -1118,6 +1118,10 @@
{
"field": "classification.name",
"boost": 7.0
},
{
"field": "classification.displayName",
"boost": 7.0
}
],
"aggregations": [

View File

@ -437,3 +437,52 @@ test.fixme('Classification Page', async ({ page }) => {
).not.toBeVisible();
});
});
test('Search tag using classification display name should work', async ({
page,
}) => {
const displayNameToSearch = tag.responseData.classification.displayName;
await table.visitEntityPage(page);
await page.waitForLoadState('networkidle');
const initialQueryResponse = page.waitForResponse('**/api/v1/search/query?*');
await page
.getByTestId('KnowledgePanel.Tags')
.getByTestId('tags-container')
.getByTestId('add-tag')
.first()
.click();
await initialQueryResponse;
const tagSearchResponse = page.waitForResponse(
`/api/v1/search/query?q=*${encodeURIComponent(displayNameToSearch)}*`
);
// Enter the display name in the search box
await page.fill('[data-testid="tag-selector"] input', displayNameToSearch);
const response = await tagSearchResponse;
const searchResults = await response.json();
// Verify that we got search results
expect(searchResults.hits.hits.length).toBeGreaterThan(0);
// Verify that the classification display name is shown in search input
await expect(
page.locator('[data-testid="tag-selector"] > .ant-select-selector')
).toContainText(displayNameToSearch);
// Verify that the tag with matching display name is shown in dropdown
await expect(
page.locator('.ant-select-dropdown').getByText(tag.responseData.displayName)
).toBeVisible();
// Verify the tag is selectable in the dropdown
await expect(
page.getByTestId(`tag-${tag.responseData.fullyQualifiedName}`)
).toBeVisible();
});