Skip to content

Fixes #33456: align glossary synonym mappings - #34052

Merged
sonika-shah merged 5 commits into
open-metadata:mainfrom
aniruddhaadak80:fix/glossary-synonym-mappings
Nov 5, 2026
Merged

sonika-shah merged 5 commits into
open-metadata:mainfrom
aniruddhaadak80:fix/glossary-synonym-mappings

Conversation

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #33456

I aligned the English, Russian, and Chinese glossary-term synonym mappings with the existing Japanese n-gram subfield. Each locale now analyzes the base synonyms field, exposes synonyms.ngram with om_ngram, and retains a keyword subfield; Chinese also gains the missing synonyms.keyword mapping.

The cross-language mapping regression test now locks the analyzer and both subfields so a future locale copy cannot silently remove the boosted search path.

Deployment note: reindex glossary_term_search_index after deploying this change so existing glossary-term documents use the new mapping and analyzers.

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 - locale mapping correction with a focused regression test.

Tests:

Use cases covered

  • English, Russian, and Chinese synonym fields use om_analyzer on the base field.
  • English, Russian, and Chinese expose synonyms.ngram with the om_ngram analyzer.
  • English, Russian, and Chinese expose synonyms.keyword; this restores exact matching support for Chinese.

Unit tests

  • Added a cross-language mapping regression test.
  • File updated: openmetadata-service/src/test/java/org/openmetadata/service/search/IndexMappingNestedFieldConsistencyTest.java
  • Coverage: not measured locally because this contribution was prepared remote-only; GitHub Actions results are reported on the PR.
  • Exact commands:
    • mvn -B -pl openmetadata-service -am -Dtest=IndexMappingNestedFieldConsistencyTest -Dsurefire.failIfNoSpecifiedTests=false test
    • mvn -B spotless:check
    • mvn -B -pl openmetadata-service -am -Pstatic-code-analysis -DfailIfNoTests=false -Dsonar.skip=true package
  • Local execution: not performed; no local checkout, source files, or Git push were used.

Backend integration tests

  • N/A - mapping resources are validated directly by the focused unit test.

Ingestion integration tests

  • N/A - no ingestion changes.

Playwright (UI) tests

  • N/A - no UI changes.

Manual testing performed

Not performed in this remote-only contribution. After deployment, reindex glossary_term_search_index before manually verifying synonym queries in each affected locale.

UI screen recording / screenshots:

Not applicable - no UI changes.

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.
  • N/A - no non-obvious workaround comments were needed.
  • N/A - these are index mapping resources, not JSON Schema changes.
  • N/A - no UI changes.
  • I have added tests and listed them above.
  • I have added a test that covers the exact scenario being fixed.

@aniruddhaadak80
aniruddhaadak80 requested a review from a team as a code owner September 25, 2026 14:10
@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!

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@Vishnuujain

Vishnuujain commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@aniruddhaadak80 Thanks for picking this up! One thing before it can go in: for zh, synonyms should use ik_max_word with ik_smart as the search analyzer, same as displayName in that file, since om_analyzer won't split Chinese text.

@pmbrull
pmbrull requested a review from IceS2 November 3, 2026 15:14
Copilot AI balanced review requested due to automatic review settings November 5, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 5, 2026

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!

om_analyzer in the zh mapping uses the letter tokenizer, which keeps Chinese
text as one token, so partial Chinese synonym queries would stop matching the
boosted synonyms field. Use ik_max_word/ik_smart like the other zh text fields,
and check each locale's synonyms analyzers against its displayName.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 5, 2026

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!

Copilot AI balanced review requested due to automatic review settings November 5, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 5, 2026

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!

@gitar-bot

gitar-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Adding analyzer and subfield mappings to glossary-term indexes requires reindexing; stale mappings could make synonym searches behave inconsistently.

Aligns English, Russian, and Chinese glossary synonym mappings with the Japanese n-gram subfield, adding synonyms.ngram with om_ngram and synonyms.keyword across locales. Resolved the Chinese om_analyzer issue that used a letter tokenizer and broke CJK matching. No open issues found.

✅ 1 closed
✅ Bug: zh synonyms now use letter-tokenizer om_analyzer, breaking CJK matching

📄 openmetadata-spec/src/main/resources/elasticsearch/zh/glossary_term_index_mapping.json:312-313 📄 openmetadata-spec/src/main/resources/elasticsearch/zh/glossary_term_index_mapping.json:18-26 📄 openmetadata-service/src/test/java/org/openmetadata/service/search/IndexMappingNestedFieldConsistencyTest.java:60 📄 openmetadata-service/src/test/java/org/openmetadata/service/search/IndexMappingNestedFieldConsistencyTest.java:69-71
In the zh mapping, om_analyzer is letter tokenizer + lowercase/asciifolding/English stemmers (lines 18-26). The letter tokenizer does not split CJK text, so a synonym like 数据库表 becomes one token. Before this PR the field used the default standard analyzer, which splits CJK into one token per character. After the change, a partial Chinese query such as 数据库 no longer matches the base synonyms field, which searchSettings.json boosts at 5.0. Only the fuzzy synonyms.ngram path (boost 1.0) still matches, so Chinese synonym relevance gets worse. Other Chinese text fields in this file (displayName, description) use ik_max_word, and the jp mapping keeps the default analyzer on synonyms. The new test also hard-codes om_analyzer for zh, which locks the regression in. Fix: use ik_max_word (or leave the default analyzer) for zh synonyms, and make the test check the analyzer per locale.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@sonika-shah sonika-shah added the safe to test Add this label to run secure Github workflows on PRs label Nov 5, 2026
@sonika-shah
sonika-shah merged commit 6ea2843 into open-metadata:main Nov 5, 2026
80 of 90 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

mohityadav766 added a commit that referenced this pull request Nov 9, 2026
…imit (#37385)

synonyms.ngram, added by #34052, used om_ngram to analyze the query as well as the index, so every query word became one clause per 3-20-character n-gram. Together with name.ngram and displayName.ngram, that took the composite-alias search past the glossary term shard's 1024-clause limit. SearchCountConsistencyIT has failed in main's nightly embedded search lane on every run since 11-05.

The en and ru mappings now analyze synonyms.ngram queries with om_compound_analyzer. A word inside a synonym still matches the stored n-grams, at one clause per word. zh keeps its 2-3-character n-grams on both sides; they stay few, and Chinese partial matching needs them.

GlossarySynonymNgramIT covers both behaviors. On the previous mapping, its 80-letter query fails with maxClauseCount.
sonika-shah pushed a commit that referenced this pull request Dec 1, 2026
…37483)

#34052 checked each locale's `synonyms` analyzers against its `displayName`
and fixed en, ru and zh. ko was left on the default `standard` analyzer with
no subfields, so two things are broken there:

- `GlossaryTermIndex` boosts `synonyms.ngram` at 1.0 and `searchSettings.json`
  declares it as a search field, but the subfield does not exist in the ko
  mapping, so that leg of the query matches nothing.
- `synonyms` itself is indexed with `standard`, so Korean synonyms are not
  segmented. A synonym written as "회원의 가입" is not found by searching
  "회원 가입", which is the gap #30831 closed everywhere except this field.

This gives ko the same shape zh already has, substituting the Korean analyzer
for IK the same way #30831 did: `nori` where zh uses `ik_max_word`/`ik_smart`,
and `om_ngram` for the ngram subfield, which is already defined in this file.

Requires a reindex of `glossary_term_search_index` to take effect.
`IndexMappingVersionTracker` reports glossaryTerm as the only changed mapping.

Co-authored-by: kyun6318 <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
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.

Glossary synonym matching is degraded by a broken synonyms mapping

4 participants