Skip to content

Entity Type quick filter labels are formatted on UI side for proper readable casing.#27515

Open
Jenishpadasala30 wants to merge 4 commits intoopen-metadata:mainfrom
Jenishpadasala30:fix_26805
Open

Entity Type quick filter labels are formatted on UI side for proper readable casing.#27515
Jenishpadasala30 wants to merge 4 commits intoopen-metadata:mainfrom
Jenishpadasala30:fix_26805

Conversation

@Jenishpadasala30
Copy link
Copy Markdown

@Jenishpadasala30 Jenishpadasala30 commented Apr 18, 2026

Describe your changes:

Fixes #26805

Problem

Explore quick filters were displaying values in lowercase (e.g., sample_airflow, john.doe) due to Elasticsearch .keyword fields using lowercase_normalizer. This caused a poor user experience as original casing from the data source was not preserved.

Solution

  • Leveraged backend support for sourceFields (introduced in Fix : case-insensitive issue with aggregation API response  #20734)
  • Enabled top_hits sub-aggregation to fetch original values from _source
  • Updated UI to dynamically pass sourceFields based on filter keys
  • Modified aggregation parsing to use _source values instead of bucket.key
  • Ensured fallback to existing behavior when sourceFields is not provided

Implementation

  • Passed sourceFields through ExploreQuickFilters → ExploreUtils → API

  • Updated getOptionsFromAggregationBucket to extract values from top_hits

  • Added safety checks to handle missing top_hits data

  • Covered special cases like:

    • service.nameservice.displayName
    • tags.tagFQNtags.displayName
    • tier.tagFQNtags.displayName

Testing

  • Verified UI shows proper casing:

    • sample_airflowSAMPLE_AIRFLOW
    • john.doeJohn Doe
    • productProduct Domain
  • Confirmed API returns top_hits only when sourceFields is passed

  • Tested fallback behavior when sourceFields is not provided

  • Added unit tests for aggregation parsing logic

Result

Explore quick filters now display correctly cased values while maintaining case-insensitive filtering behavior.

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes #26805: Preserve casing in Explore quick filters using sourceFields
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: Not applicable
  • I have added a test that covers the exact scenario we are fixing.

Summary by Gitar

  • Refactored search utility:
    • Moved getSearchAPIQueryParams into miscAPI.ts to centralize search parameter generation.
    • Added logic to conditionally append sort_field, sort_order, and track_total_hits to API parameters.

This will update automatically on new commits.

@Jenishpadasala30 Jenishpadasala30 requested a review from a team as a code owner April 18, 2026 20:04
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Comment thread openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchUtils.tsx Outdated
…omprehensive documentation and test coverage
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@Jenishpadasala30 Jenishpadasala30 changed the title Fix 26805 Entity Type quick filter labels are formatted on UI side for proper readable casing. Apr 19, 2026
@Jenishpadasala30 Jenishpadasala30 changed the title Entity Type quick filter labels are formatted on UI side for proper readable casing. Entity Type quick filter labels are formatted on UI side for proper readable casing.#26805 Apr 19, 2026
@Jenishpadasala30 Jenishpadasala30 changed the title Entity Type quick filter labels are formatted on UI side for proper readable casing.#26805 Entity Type quick filter labels are formatted on UI side for proper readable casing. Apr 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Apr 22, 2026
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 22, 2026

Code Review ✅ Approved 2 resolved / 2 findings

Entity Type quick filter labels now support proper UI-side casing and correctly handle array field traversal. The previously broken import path has been corrected to ensure successful compilation.

✅ 2 resolved
Bug: Test file has wrong import path — will fail to compile

📄 openmetadata-ui/src/main/resources/ui/src/utils/tests/AdvancedSearchUtils.casePreservation.test.tsx:14
The test file is located in src/utils/__tests__/ but imports from './AdvancedSearchUtils', which resolves to __tests__/AdvancedSearchUtils (non-existent). Since it uses a relative ./ prefix, Jest's moduleDirectories: ['node_modules', 'src'] won't help — relative imports always resolve from the file's own directory. The import should be '../AdvancedSearchUtils' to reach the parent src/utils/AdvancedSearchUtils.tsx.

Bug: Dot-notation traversal fails for array fields (tags, owners)

📄 openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchUtils.tsx:407-415
The getOptionsFromAggregationBucket function traverses _source using dot-notation (e.g., tags.displayName). However, fields like owners, tags, and domains are stored as arrays in Elasticsearch _source (e.g., _source.tags = [{tagFQN: '...', displayName: '...'}, ...]). When the reduce encounters an array at _source.tags, attempting to access .displayName on it will fail the key in obj check and return undefined, causing a silent fallback to bucket.key.

This means the case-preservation feature won't work for tag-based or owner-based filters — the intended use cases mentioned in the PR description (tags.tagFQN → tags.displayName).

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions
Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 61%
62.04% (60393/97345) 42.05% (31683/75334) 45.06% (9512/21107)

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (12 flaky)

✅ 3699 passed · ❌ 0 failed · 🟡 12 flaky · ⏭️ 89 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 479 0 2 4
🟡 Shard 2 654 0 2 7
🟡 Shard 3 665 0 1 1
🟡 Shard 4 645 0 3 27
✅ Shard 5 611 0 0 42
🟡 Shard 6 645 0 4 8
🟡 12 flaky test(s) (passed on retry)
  • Pages/Customproperties-part1.spec.ts › Timestamp (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel move operation (shard 2, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Database Schema (shard 4, 1 retry)
  • Pages/Entity.spec.ts › User as Owner with unsorted list (shard 4, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/UserDetails.spec.ts › Create team with domain and verify visibility of inherited domain in user profile after team removal (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@Rohit0301
Copy link
Copy Markdown
Contributor

@Jenishpadasala30 can you please add the playwright test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement proper casing for Explore quick filters using sourceFields

2 participants