Repository navigation
fix(search): route column search through the structured builder so counts match results (#31106) [1.13 backport] - #31207
Conversation
…unts match results (#31106) index=tableColumn (the Explore Columns tab) went through buildColumnSearchBuilderV2, a permissive multi_match (best_fields, operator OR) that omitted fqnParts. An FQN query therefore OR-matched every column sharing a parent-name token and returned the whole column index (e.g. 7381), while the dataAsset aggregation that backs the tab count uses the structured builder (operator AND over fqnParts) and correctly returns 1. Route column indexes through buildDataAssetSearchBuilderV2 so they use the existing "tableColumn" AssetTypeConfiguration (fqnParts + AND): an FQN search now matches the one column precisely (count == results) and column-name search still works via the config's name/name.ngram fields. Removes the now-unused buildColumnSearchBuilderV2 from both engine factories. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
❌ PR checklist incompleteThis 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 |
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsBackports column search routing through the structured builder to align counts with search results, accompanied by new integration and unit tests. Consider replacing the hard-coded sleep in the integration test with polling to avoid flakiness. 💡 Quality: Fixed 2s sleep for indexing wait is flakyThe new 🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| // Wait for indexing | ||
| TimeUnit.SECONDS.sleep(2); |
There was a problem hiding this comment.
💡 Quality: Fixed 2s sleep for indexing wait is flaky
The new testColumnFqnSearchIsPrecise waits for async indexing with a hard-coded TimeUnit.SECONDS.sleep(2). A fixed sleep is inherently flaky under CI load (may still be un-indexed after 2s) and wastes time when indexing finishes sooner; the project's test guidelines call for condition-based waiting (Awaitility) instead. The PR notes this was a deliberate backport concession because the Awaitility helpers aren't on 1.13, so this is minor/informational — if a polling helper is available on 1.13, prefer it; otherwise leave as-is to match the file's existing convention.
Was this helpful? React with 👍 / 👎
Backport of #31106 to
1.13.Describe your changes:
Fixes open-metadata/openmetadata-collate#3851 on the 1.13 line.
The Explore Columns tab shows a count of 1 but the results list shows 7,381. Root cause:
index=tableColumnresults were built bybuildColumnSearchBuilderV2— a permissivemulti_match(best_fields,operator: OR) that does not searchfqnParts. An FQN query therefore OR-matched every column that shares a parent-name token (service/db/schema/table) and returned the whole column index, while thedataAssetaggregation that backs the tab count uses the structured builder (operator: ANDoverfqnParts) and correctly returns 1.Fix: route column indexes through
buildDataAssetSearchBuilderV2(liketabledoes) so they use the existingtableColumnAssetTypeConfiguration, which already hasfqnParts+ structured match types. An FQN search now matches the one column precisely (count == results), and column-name search still works via the config'sname/name.ngramfields. The now-unusedbuildColumnSearchBuilderV2is removed from both engine factories.Backport notes (differences from the
maincommit):maincommit applied verbatim to bothSourceBuilderFactoryfiles (the V2 builder architecture is identical on 1.13).ColumnSearchIndexIT#testColumnFqnSearchIsPrecisewas adapted to 1.13's existing IT conventions (fixedTimeUnit.SECONDS.sleep(2)wait +"column_search_index"string literal) because theAwaitilitypolling helpers andCOLUMN_SEARCH_INDEXconstant used onmainare from later, un-backported IT refactors. Assertions are unchanged (total == 1, single hit is the searched column).SearchSourceBuilderFactoryTest#testColumnIndexUsesStructuredDataAssetBuilderapplied as-is (itsserializeOpenSearchRequesthelper + imports were brought along, since they were pre-existing onmainbut absent on 1.13).Type of change:
Tests:
SearchSourceBuilderFactoryTest#testColumnIndexUsesStructuredDataAssetBuilder—index=tableColumnnow emits a query carryingfqnParts+"operator":"and"(OpenSearch and Elasticsearch). Verified locally:Tests run: 13, Failures: 0, Errors: 0.ColumnSearchIndexIT#testColumnFqnSearchIsPrecise— against real OpenSearch, searching a column's full FQN returns exactly that column (total == 1). Compile-verified locally; runs in CI against the Docker/OpenSearch stack.🤖 Generated with Claude Code