Repository navigation
Fixes #22011: Make search accent-insensitive - #33600
Conversation
A Portuguese speaker whose table is named "Manutenção" types "Manutencao" and gets nothing back. The mirror case fails too: the person searching does not know whether whoever named the asset used accents, so "Ambulatório" must also reach a table named "Ambulatorio". om_analyzer tokenized "Operatório" to "operatório", so the indexed term and the query term never unified. The n-gram band could not rescue it either -- every 3-gram spanning the accent differs from the query's. No asciifolding existed anywhere in the en/jp/zh analysis chains; ru had it in two of its five, which is why Russian deployments never saw this. Add asciifolding directly after lowercase in every chain that lowercases, across all 250 mapping files. The position is load-bearing: folding is a case-sensitive mapping, so it has to run after lowercase, and before the stemmers so they see the folded token. The keyword normalizer is included because the exact-match ranking stage queries name.keyword -- without it an accented name is found but never reaches the identity band, and a row that merely starts with the query takes the top result away from it. This also closes the gaps in ru, whose om_ngram and om_compound_analyzer never folded. Existing deployments pick this up on their own: IndexMappingVersionTracker hashes each mapping file, so the changed mappings trigger a reindex on upgrade. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| "filter": [ | ||
| "lowercase" | ||
| "lowercase", | ||
| "asciifolding" |
There was a problem hiding this comment.
Accent-distinct facets collapse
Adding asciifolding to lowercase_normalizer makes distinct facet values that differ only by accents share one keyword term. For example, coexisting Manutenção and Manutencao domains now produce the same aggregation bucket. Selecting that bucket issues a term filter that matches both domains, so users cannot distinguish or filter them independently. The same issue affects fields such as tags.tagFQN that use this normalizer.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
This reverts commit 68496f6. The advisory response document is unrelated to the accent-insensitive search change and was committed to this branch by mistake. Co-Authored-By: Claude Opus 5 <[email protected]>
Code Review ✅ Approved🔴 High risk Adds accent-insensitive search by inserting OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Describe your changes:
Fixes #22011
A Portuguese speaker whose table is named
ManutençãotypesManutencaoand gets zero results. The mirror case fails too — the person searching does not know whether whoever named the asset used accents, soAmbulatóriomust also reach a table namedAmbulatorio.om_analyzertokenizedOperatóriotooperatório, so the indexed term and the query term never unified. The n-gram band could not rescue it either: every 3-gram spanning the accent differs from the query's. Noasciifoldingexisted anywhere in theen/jp/zhanalysis chains —ruhad it in two of its five, which is why Russian deployments never saw this.I added
asciifoldingto every analysis chain that lowercases, across all 250 mapping files.Type of change:
High-level design:
Approach.
asciifoldingis inserted directly afterlowercasein every analyzer and normalizer that lowercases:The position is load-bearing, and is asserted by a test rather than left to reviewer memory:
lowercaseor the uppercase forms are left alone;Why the keyword normalizer is included. The
exactNameranking stage queriesname.keyword/displayName.keyword/fullyQualifiedName. Without folding there, an accented name is found but never reaches the identity band, so a row that merely starts with the query takes the top result away from the asset the query actually names. This is theOperatóriovsOperatorio_Backupcase in the tests.Scope. All four languages.
asciifoldingis a built-in filter and was already on this repo's built-in allowlist (IndexAnalyzerMappingTest.everyAnalyzerFilterIsDefinedOrBuiltIn), so no filter declarations were needed. The change also closes pre-existing gaps inru, whoseom_ngramandom_compound_analyzernever folded.om_analyzer_jp(kuromoji) is untouched — it has nolowercasestage, and thejpmappings carry a latinom_analyzeralongside it that does fold.Alternative considered. A second, dedicated normalizer applied only to
name.keyword/displayName.keyword/fullyQualifiedName, leavinglowercase_normalizeralone. Rejected for consistency with therumappings, which have shipped wholesale folding for a while, and because accent-insensitive filtering is desirable on the same grounds as accent-insensitive search. See "Behaviour change to be aware of" below — happy to switch if reviewers prefer the narrower blast radius.Rollout / backward compatibility. No migration script is needed.
IndexMappingVersionTrackerhashes each mapping file and reindexes entities whose hash changed, so existing deployments pick this up automatically on upgrade. Until that reindex completes, accented documents keep their old tokens — the same rolling behaviour as any other mapping change.Behaviour change to be aware of.
lowercase_normalizeris also on facet fields (tags.tagFQN,domains.displayName.keyword,ownerDisplayName). Terms-aggregation bucket keys come from doc values, so a tag namedNão Públicowill now render asnao publicoin Explore facets. These keys are already lowercased today, so this is an incremental change of the same kind, but it is user-visible. The flip side is that filtering becomes accent-insensitive too.Tests:
Use cases covered
Manutencaofinds the table namedManutenção(cedilla + tilde).Ambulatório_Geralfinds the table namedAmbulatorio_Geral(accented query, plain-ASCII asset).cirurgicofinds a table whose description reads "bloco cirúrgico".Operatoriogets the table namedOperatórioranked first, aboveOperatorio_Backup, which merely starts with the query as a literal token.en/jp/ru/zhstill creates and still serves the Explore / RBAC / Data Quality queries that depend on it.Unit tests
IndexAnalyzerMappingTest.everyLowercasingChainAlsoFoldsAccents— asserts across all four languages that every analyzer and normalizer which lowercases also folds, directly afterlowercase. The analysis block is duplicated into each of the 250 mapping files and a new entity is added by copying an existing one, so this is the drift guard for the whole set.openmetadata-service/src/test/java/org/openmetadata/service/search/IndexAnalyzerMappingTest.javaen244,jp239,ru131,zh235, root 3). GREEN after: 0.openmetadata-specindex-mapping resources; the two Java files touched are tests.IndexAnalyzerMappingTest,SearchIndexSettingsTest,SearchSourceBuilderFactoryTest,DataProductIndexMappingTest,SearchIndexFactoryTest,SearchRankingHelperTest,SearchIndexReindexFieldsParityTest.Backend integration tests
Added
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/AccentInsensitiveSearchIT.java(4 tests). Nothing is mocked: tables are created through the real API and searched through/v1/search/query, so the shippedsearchSettings.json, the real index mappings and a live search engine are all in the loop.Verified RED → GREEN on both engines:
No regressions in the neighbouring search ITs (Elasticsearch):
SearchResourceIT69,SearchConsumerFieldBehaviorIT20,IndexTemplateIT10,SearchRankingRelevanceIT5 — all green.SearchConsumerFieldBehaviorITis the meaningful one here: it creates the real index foren/jp/ru/zhand runs the actual Explore/RBAC/Data-Quality queries against each, so it proves the folded mappings are valid and behaviourally intact in every language.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Verification here was the automated end-to-end suite above rather than a click-through, since the change is in the analysis chain and the ITs drive the real API and real engine. Reproducible:
mvn -o install -pl openmetadata-spec -DskipTestsmvn -o verify -pl openmetadata-integration-tests -Dit.test=AccentInsensitiveSearchITmvn -o verify -pl openmetadata-integration-tests -Ppostgres-opensearch -Dit.test=AccentInsensitiveSearchITopenmetadata-spec/src/main/resources/elasticsearch/, reinstall, re-run either — all 4 fail, three of them returning zero hits.Root cause was also confirmed directly against a live node via
_analyze: pre-fix,om_analyzeronOperatórioemits[operatório]; post-fix it emits[operatorio].UI screen recording / screenshots:
Not applicable — no UI changes.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.IndexMappingVersionTrackerreindexes on hash change, so no migration script is required.Note for reviewers
SearchRankingRelevanceIT.singularQueryFindsThePluralTablefails on OpenSearch when it shares a lane with the new IT. I confirmed this is not caused by this change: with and without the fix it produces byte-identical scores,23.880476vs23.877653. BM25 term statistics are shard-wide rather than filtered, so any test adding rows totable_search_indexperturbs them, and that assertion decides a strict ordering on a 0.012% margin while its siblings in the same class use a 1.25x band ratio. Pre-existing fragility, but it will surface in CI if both land in the same lane — happy to give that assertion the same band-ratio treatment in this PR or a follow-up.🤖 Generated with Claude Code
The search-analyzer changes are well tested, but the unresolved collapse of accent-distinct keyword facet values remains blocking.
Findings
Summary
The PR makes search accent-insensitive by adding
asciifoldingimmediately afterlowercasethroughout the Elasticsearch/OpenSearch analyzers and normalizers for all shipped languages.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Indexed or queried text] --> B[Tokenizer] B --> C[lowercase] C --> D[asciifolding] D --> E{Analysis chain} E --> F[Stemming] E --> G[N-gram generation] E --> H[Keyword normalization] F --> I[Accent-insensitive search terms] G --> I H --> J[Exact-match, filter, and facet terms]Reviews (6) · Last reviewed commit: "Merge branch 'main' into fix/22011-accen..."