Skip to content

fix(search): route column search through the structured builder so counts match results (#31106) [1.13 backport] - #31207

Merged
mohityadav766 merged 1 commit into
1.13from
cherry-pick-31106-to-1.13
Aug 7, 2026
Merged

mohityadav766 merged 1 commit into
1.13from
cherry-pick-31106-to-1.13

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

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=tableColumn results were built by buildColumnSearchBuilderV2 — a permissive multi_match (best_fields, operator: OR) that does not search fqnParts. 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 the dataAsset aggregation that backs the tab count uses the structured builder (operator: AND over fqnParts) and correctly returns 1.

Fix: route column indexes through buildDataAssetSearchBuilderV2 (like table does) so they use the existing tableColumn AssetTypeConfiguration, which already has fqnParts + structured match types. 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. The now-unused buildColumnSearchBuilderV2 is removed from both engine factories.

Backport notes (differences from the main commit):

  • The main commit applied verbatim to both SourceBuilderFactory files (the V2 builder architecture is identical on 1.13).
  • The integration test ColumnSearchIndexIT#testColumnFqnSearchIsPrecise was adapted to 1.13's existing IT conventions (fixed TimeUnit.SECONDS.sleep(2) wait + "column_search_index" string literal) because the Awaitility polling helpers and COLUMN_SEARCH_INDEX constant used on main are from later, un-backported IT refactors. Assertions are unchanged (total == 1, single hit is the searched column).
  • The unit test SearchSourceBuilderFactoryTest#testColumnIndexUsesStructuredDataAssetBuilder applied as-is (its serializeOpenSearchRequest helper + imports were brought along, since they were pre-existing on main but absent on 1.13).

Type of change:

  • Bug fix

Tests:

  • SearchSourceBuilderFactoryTest#testColumnIndexUsesStructuredDataAssetBuilder — index=tableColumn now emits a query carrying fqnParts + "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

…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]>
@mohityadav766
mohityadav766 requested a review from a team as a code owner August 7, 2026 17:00
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

  • Linked issue open-metadata/openmetadata-collate#3851 does not exist or is not accessible.

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.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Aug 7, 2026
@mohityadav766
mohityadav766 merged commit f9355eb into 1.13 Aug 7, 2026
52 of 56 checks passed
@mohityadav766
mohityadav766 deleted the cherry-pick-31106-to-1.13 branch August 7, 2026 17:01
@gitar-bot

gitar-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Running post-merge workflows

Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Backports 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 flaky

📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ColumnSearchIndexIT.java:107-108

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.

🤖 Prompt for agents
Code Review: Backports 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.

1. 💡 Quality: Fixed 2s sleep for indexing wait is flaky
   Files: openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ColumnSearchIndexIT.java:107-108

   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.

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

Comment on lines +107 to +108
// Wait for indexing
TimeUnit.SECONDS.sleep(2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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 👍 / 👎

This branch was previously deployed

1 inactive deployment
test — c18baa0f Deployed Aug 7, 2026 by mohityadav766 via playwright-ci-postgresql (4, 6) #65268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 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.

1 participant