Skip to content

swap hybrid default values keyword vs semantic - #31968

Merged
pmbrull merged 8 commits into
mainfrom
feat-swap-hybrid-default-values
Aug 31, 2026
Merged

pmbrull merged 8 commits into
mainfrom
feat-swap-hybrid-default-values

Conversation

@tomasmontielp

@tomasmontielp tomasmontielp commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #31967

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

N/A — small change.

Tests:

Use cases covered

Unit tests

Backend integration tests

Ingestion integration tests

Playwright (UI) tests

Manual testing performed

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

Summary by Gitar

  • Search Configuration:
    • Swapped default hybrid search weights in SearchRepository.java and JSON schemas to 0.6 for keyword and 0.4 for semantic search
    • Added MySQL and PostgreSQL v2.1 data migrations to align stored search settings with the new default weights

This will update automatically on new commits.

Greptile Summary

The PR swaps the default hybrid-search weighting to favor keyword search and aligns persisted settings during the v2.1.0 migration.

  • Changes keyword and semantic defaults from 0.4/0.6 to 0.6/0.4 across schemas and runtime fallbacks.
  • Adds matching MySQL and PostgreSQL migration steps that update the former persisted default pair.
  • Adds tests for swapping, idempotency, customized values, and absent settings.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java Adds an idempotent persisted-weight alignment that updates only the former default pair and preserves other configurations.
openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v210/Migration.java Runs hybrid-weight alignment as part of the MySQL v2.1.0 data migration.
openmetadata-service/src/main/java/org/openmetadata/service/migration/postgres/v210/Migration.java Runs hybrid-weight alignment as part of the PostgreSQL v2.1.0 data migration.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java Updates the runtime fallback weights to keyword 0.6 and semantic 0.4.
openmetadata-spec/src/main/resources/json/schema/configuration/searchSettings.json Updates persisted search-setting defaults to the new hybrid weighting.
openmetadata-spec/src/main/resources/json/schema/configuration/elasticSearchConfiguration.json Updates Elasticsearch configuration defaults consistently with runtime and persisted settings.
openmetadata-service/src/test/java/org/openmetadata/service/migration/utils/v210/HybridSearchWeightSwapTest.java Covers the migration swap, customized pairs, idempotency, partial matches, and absent values.

Reviews (7): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@tomasmontielp tomasmontielp self-assigned this Aug 24, 2026
@tomasmontielp
tomasmontielp requested a review from a team as a code owner August 24, 2026 14:09
@tomasmontielp tomasmontielp added the safe to test Add this label to run secure Github workflows on PRs label Aug 24, 2026
pmbrull
pmbrull previously approved these changes Aug 24, 2026
@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit befbe6ef8a424de867b793254bebf385e94383e8 in Playwright run 33381140079, attempt 1.

✅ 1146 passed · ❌ 0 failed · 🟡 7 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 57m 58s

⏱️ Max setup 4m 3s · max shard execution 19m 38s · max shard-job elapsed before upload 23m 13s · reporting 9s

🌐 203.42 requests/attempt · 2.25 app boots/UI scenario · 36.08% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 36.08% (convergence target: at most 15%).
  • Browser traffic was 203.42 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.25 per UI scenario (2670 boots / 1185 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 139 0 0 0 0 0
🟡 Shard chromium-02 177 0 2 0 0 0
🟡 Shard chromium-03 168 0 2 0 0 0
🟡 Shard chromium-04 160 0 2 0 0 0
✅ Shard chromium-05 138 0 0 0 0 0
🟡 Shard chromium-06 174 0 1 0 0 0
✅ Shard data-asset-rules-01 63 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 33 0 0 0 0 0
✅ Shard import-export-01 7 0 0 0 0 0
✅ Shard ingestion-01 2 0 0 0 0 0
✅ Shard reindex-01 28 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 7 flaky test(s) (passed on retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard chromium-02, 1 retry)
  • Pages/Glossary.spec.ts › Approve and reject glossary term from Glossary Listing (shard chromium-02, 1 retry)
  • Features/AdvancedSearchSuggestions.spec.ts › Verify suggestions for Database field (shard chromium-03, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should verify deleted tag not visible in tag selection for topic (shard chromium-03, 1 retry)
  • Pages/Entity.spec.ts › User should be denied access to edit description when deny policy rule is applied on an entity (shard chromium-04, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should follow Data Consumer role policies for ownerless dashboardDataModel (shard chromium-04, 1 retry)
  • Pages/Glossary.spec.ts › Glossary & terms creation for reviewer as team (shard chromium-06, 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

pmbrull
pmbrull previously approved these changes Aug 26, 2026
@pmbrull
pmbrull added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-08-26T16:57:10Z)

Blocked the queue: playwright-summary

…ult-values

# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v210/Migration.java
#	openmetadata-service/src/main/java/org/openmetadata/service/migration/postgres/v210/Migration.java
#	openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java
@gitar-bot

gitar-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 2 resolved / 3 findings

Swaps hybrid search default weights from 0.4/0.6 (keyword/semantic) to 0.6/0.4 across runtime configuration and JSON schemas, with guarded v2.1 data migrations for MySQL and PostgreSQL to align persisted settings. Comprehensive test coverage includes migration idempotency and operator-tuned value preservation. Consider normalizing displayName in domain EntityReferences within the query update script (getScriptWithParams) to maintain consistency with freshly indexed documents.

💡 Bug: Query domain update script skips displayName normalization

📄 openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:3821-3823

In getScriptWithParams (SearchRepository.java:3821) the painless update pushes raw entity.getDomains() into ctx._source.domains, whereas the initial index document builds domains via getEntitiesWithDisplayName(...) (SearchIndex.java:193) which clones each EntityReference and backfills a missing displayName from name. As a result, query search documents updated through this path can end up with domains missing displayName, producing inconsistent facets/filters compared to freshly indexed docs. Wrap the value in getEntitiesWithDisplayName(entity.getDomains()) for parity.

Normalize domain references the same way initial indexing does so displayName is populated.
fieldAddParams.put(
    FIELD_DOMAINS,
    org.openmetadata.service.search.indexes.SearchIndex.getEntitiesWithDisplayName(
        entity.getDomains()));
✅ 2 resolved
✅ Quality: Javadoc claims thread-storage archival that migration never runs

📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java:25-28 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java:45-59 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v210/Migration.java:14-17 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/postgres/v210/Migration.java:14-17
The class javadoc now states this v2.1.0 migration performs "archival of legacy thread storage after task cutover, and alignment of stored hybrid search weights", but the new Migration.runDataMigration() only calls alignHybridSearchWeightsWithDefaults(); archiveLegacyThreadStorage() has no callers anywhere in the codebase. This is misleading documentation. Either wire archiveLegacyThreadStorage() into runDataMigration() (if it was intended to run) or drop the archival wording from the javadoc.

✅ Edge Case: Migration overwrites operators who intentionally chose old default pair

📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java:116-127
An operator who deliberately configured keyword=0.4 / semantic=0.6 (identical to the former shipped default) will have their choice silently swapped to 0.6/0.4 by this migration, since it cannot distinguish an intentional setting from the seeded old default. This tradeoff is acknowledged in the javadoc, so it is low severity, but it is worth confirming that no known deployments intentionally use the 0.4/0.6 pair before release.

🤖 Prompt for agents
Code Review: Swaps hybrid search default weights from 0.4/0.6 (keyword/semantic) to 0.6/0.4 across runtime configuration and JSON schemas, with guarded v2.1 data migrations for MySQL and PostgreSQL to align persisted settings. Comprehensive test coverage includes migration idempotency and operator-tuned value preservation. Consider normalizing `displayName` in domain EntityReferences within the query update script (`getScriptWithParams`) to maintain consistency with freshly indexed documents.

1. 💡 Bug: Query domain update script skips displayName normalization
   Files: openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:3821-3823

   In getScriptWithParams (SearchRepository.java:3821) the painless update pushes raw `entity.getDomains()` into `ctx._source.domains`, whereas the initial index document builds domains via `getEntitiesWithDisplayName(...)` (SearchIndex.java:193) which clones each EntityReference and backfills a missing `displayName` from `name`. As a result, query search documents updated through this path can end up with domains missing `displayName`, producing inconsistent facets/filters compared to freshly indexed docs. Wrap the value in `getEntitiesWithDisplayName(entity.getDomains())` for parity.

   Fix (Normalize domain references the same way initial indexing does so displayName is populated.):
   fieldAddParams.put(
       FIELD_DOMAINS,
       org.openmetadata.service.search.indexes.SearchIndex.getEntitiesWithDisplayName(
           entity.getDomains()));

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@tomasmontielp

Copy link
Copy Markdown
Contributor Author

Out of scope — getScriptWithParams domains handling came from main via merge (#32130, f207b9f), not this PR; this branch only touches the default weight values.

Code Review 👍 Approved with suggestions 2 resolved / 3 findings
Swaps hybrid search default weights from 0.4/0.6 (keyword/semantic) to 0.6/0.4 across runtime configuration and JSON schemas, with guarded v2.1 data migrations for MySQL and PostgreSQL to align persisted settings. Comprehensive test coverage includes migration idempotency and operator-tuned value preservation. Consider normalizing displayName in domain EntityReferences within the query update script (getScriptWithParams) to maintain consistency with freshly indexed documents.

💡 Bug: Query domain update script skips displayName normalization
📄 openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:3821-3823

In getScriptWithParams (SearchRepository.java:3821) the painless update pushes raw entity.getDomains() into ctx._source.domains, whereas the initial index document builds domains via getEntitiesWithDisplayName(...) (SearchIndex.java:193) which clones each EntityReference and backfills a missing displayName from name. As a result, query search documents updated through this path can end up with domains missing displayName, producing inconsistent facets/filters compared to freshly indexed docs. Wrap the value in getEntitiesWithDisplayName(entity.getDomains()) for parity.

Normalize domain references the same way initial indexing does so displayName is populated.

fieldAddParams.put(
    FIELD_DOMAINS,
    org.openmetadata.service.search.indexes.SearchIndex.getEntitiesWithDisplayName(
        entity.getDomains()));

✅ 2 resolved
✅ Quality: Javadoc claims thread-storage archival that migration never runs

📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java:25-28 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java:45-59 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v210/Migration.java:14-17 📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/postgres/v210/Migration.java:14-17
The class javadoc now states this v2.1.0 migration performs "archival of legacy thread storage after task cutover, and alignment of stored hybrid search weights", but the new Migration.runDataMigration() only calls alignHybridSearchWeightsWithDefaults(); archiveLegacyThreadStorage() has no callers anywhere in the codebase. This is misleading documentation. Either wire archiveLegacyThreadStorage() into runDataMigration() (if it was intended to run) or drop the archival wording from the javadoc.

✅ Edge Case: Migration overwrites operators who intentionally chose old default pair

📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/MigrationUtil.java:116-127
An operator who deliberately configured keyword=0.4 / semantic=0.6 (identical to the former shipped default) will have their choice silently swapped to 0.6/0.4 by this migration, since it cannot distinguish an intentional setting from the seeded old default. This tradeoff is acknowledged in the javadoc, so it is low severity, but it is worth confirming that no known deployments intentionally use the 0.4/0.6 pair before release.

🤖 Prompt for agents

Code Review: Swaps hybrid search default weights from 0.4/0.6 (keyword/semantic) to 0.6/0.4 across runtime configuration and JSON schemas, with guarded v2.1 data migrations for MySQL and PostgreSQL to align persisted settings. Comprehensive test coverage includes migration idempotency and operator-tuned value preservation. Consider normalizing `displayName` in domain EntityReferences within the query update script (`getScriptWithParams`) to maintain consistency with freshly indexed documents.

1. 💡 Bug: Query domain update script skips displayName normalization
   Files: openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:3821-3823

   In getScriptWithParams (SearchRepository.java:3821) the painless update pushes raw `entity.getDomains()` into `ctx._source.domains`, whereas the initial index document builds domains via `getEntitiesWithDisplayName(...)` (SearchIndex.java:193) which clones each EntityReference and backfills a missing `displayName` from `name`. As a result, query search documents updated through this path can end up with domains missing `displayName`, producing inconsistent facets/filters compared to freshly indexed docs. Wrap the value in `getEntitiesWithDisplayName(entity.getDomains())` for parity.

   Fix (Normalize domain references the same way initial indexing does so displayName is populated.):
   fieldAddParams.put(
       FIELD_DOMAINS,
       org.openmetadata.service.search.indexes.SearchIndex.getEntitiesWithDisplayName(
           entity.getDomains()));

Options
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact

gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
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.

Hybrid search: an exact name match ranks ~16th because weighted RRF ignores lexical score

2 participants