Repository navigation
Fixes #34954: keep the parent of every glossary search match in the hierarchy - #35221
Conversation
…ierarchy Hierarchy search (getHierarchy=true) ranks matches and their parent terms in one page. With more matches than the page holds, the parents rank below the cut and buildGlossaryTermSearchHierarchy drops every match whose parent is missing, so the glossary comes back with no children. - Fetch the missing parents of the page's matches in one exact-FQN lookup after the cut (Approved only, same as the search). On failure, log and fall back to the previous behaviour. - Score the parent-term clauses 0 for glossary terms, so parents never take a page slot from a real match. Domain search is unchanged. Same change in the Elasticsearch and OpenSearch managers, plus an IT that fails without it.
Code Review ✅ Approved🟡 Medium risk · Zero-scoring glossary parent clauses and fetching missing ancestors change search results; failed lookups could leave returned matches detached from the hierarchy. Fixes glossary term search with VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledOptionsDisplay: 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 |
… the hierarchy (#35221, #35284) (#35287) * Fixes #34954: keep the parent of every glossary search match in the hierarchy (#35221) Hierarchy search (getHierarchy=true) ranks matches and their parent terms in one page. With more matches than the page holds, the parents rank below the cut and buildGlossaryTermSearchHierarchy drops every match whose parent is missing, so the glossary comes back with no children. - Fetch the missing parents of the page's matches in one exact-FQN lookup after the cut (Approved only, same as the search). On failure, log and fall back to the previous behaviour. - Score the parent-term clauses 0 for glossary terms, so parents never take a page slot from a real match. Domain search is unchanged. Same change in the Elasticsearch and OpenSearch managers, plus an IT that fails without it. (cherry picked from commit cda0297) * Fixes #34954: make the glossary hierarchy search IT independent of other tests The hierarchy search IT waited for "search(word) total == 30" over the whole shared index. Glossary search matches fuzzily and on name n-grams, so other tests' terms counted too and it failed in the parallel lane with 33. Its page and child-count checks had the same exposure, and it never cleaned up its terms. - No wait or global count: entity create indexes synchronously with a refresh, so the terms are searchable when create returns. - Every search is post-filtered to the test's own glossary. - The search word uses letters absent from all generated names, so parents can never match it or take a page slot from a match. - The glossary is hard-deleted recursively in finally. - Adds the same check for matches nested four levels deep. (cherry picked from commit 72b7051) * Hold the search-settings read lock and make cleanup best-effort in hierarchy ITs The hierarchy search ITs depend on the shared glossary-term search settings, so take SEARCH_SETTINGS in READ mode: they never overlap a test that rewrites the settings under the READ_WRITE lock, and still run alongside other readers. A failed cleanup delete no longer fails a test whose assertions passed; the glossary is namespace-scoped. (cherry picked from commit 9bcc2ce)
Describe your changes:
Fixes #34954
Glossary term search with
getHierarchy=true(used by the glossary term picker) can return a glossary with no terms under it, even though terms matched.Why: the page (e.g. 25) holds the matches and the parent terms needed to draw the tree, ranked together. With more matches than the page holds, the parents rank below the cut.
buildGlossaryTermSearchHierarchyonly attaches a term whose parent is in the response, so every match is dropped and the glossary comes back aschildren: [].What changed:
fqnPartsaggregation flow is unchanged. Domain search is unchanged.ElasticSearchSearchManagerandOpenSearchSearchManager.The parent lookup builds on the backfill from #34955 (2.0). That PR keeps the picker's UI changes; this PR carries the backend fix for main, to be backported to 2.0.
Type of change:
Tests:
GlossaryTermResourceIT#test_hierarchySearchKeepsParentOfEveryMatchOnThePage: one parent that doesn't match + 30 matching children, searched withsize=25&getHierarchy=true. Asserts the parent is returned with all 25 matches under it.Parent of the matches should be returned even though it ranks last, glossary has no children).Details
Scoring. Each match also matches its own exact-FQN clause, so normally matches outrank pure parents. But the
fqnPartsaggregation is capped at 1000 buckets ordered by doc count; with many matches in deep glossaries, a leaf's own-FQN bucket (count 1) is cut first, the match loses that clause, and a parent can outrank it. Wrapping the parent clauses inconstant_scorewithboost: 0removes parents from ranking entirely. Checked on Elasticsearch 9.3 and OpenSearch 3.4: matches come back ordered by relevance, the parent last with score 0.Parent lookup. Parents are derived from each hit's FQN (term level only; the glossary root still comes from each hit's
glossaryfield) and fetched with atermsquery onfullyQualifiedName(lowercase-normalized keyword). One query, bounded by page size × depth.Not in scope. Matches ranked below the page are still not returned; that needs paging in the picker's search mode.