Skip to content

fix(search): route column search through structured builder (fqnParts + AND) - #31106

Merged
mohityadav766 merged 2 commits into
mainfrom
fix/column-search-use-structured-builder
Aug 7, 2026
Merged

fix(search): route column search through structured builder (fqnParts + AND)#31106
mohityadav766 merged 2 commits into
mainfrom
fix/column-search-use-structured-builder

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

Describe your changes:

Fixes open-metadata/openmetadata-collate#3851

The Explore Columns tab shows a count of 1 but the results list shows 7,381 (and Playwright SearchRBAC › Table Column fails). 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.

Supersedes #31019 (tightening the permissive builder's minimum_should_match regressed exact-FQN lookups to 0 hits) and #31093 (matched the badge to the inflated 7,381 instead of fixing the results).

Type of change:

  • Bug fix

Tests:

Unit tests

  • SearchSourceBuilderFactoryTest#testColumnIndexUsesStructuredDataAssetBuilderindex=tableColumn now emits a query carrying fqnParts + "operator":"and" (OpenSearch and Elasticsearch).

Integration tests

  • ColumnSearchIndexIT#testColumnFqnSearchIsPrecise — against real OpenSearch, searching a column's full FQN returns exactly that column (total == 1), not its token-sharing siblings.

🤖 Generated with Claude Code

…unts match results

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) <noreply@anthropic.com>
@mohityadav766
mohityadav766 requested a review from a team as a code owner August 6, 2026 11:50
Copilot AI review requested due to automatic review settings August 6, 2026 11:50
@github-actions

github-actions Bot commented Aug 6, 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.

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.

Pull request overview

This PR fixes an Explore Columns tab inconsistency where index=tableColumn searches could return thousands of loosely token-matching columns while the tab count (driven by the structured dataAsset aggregation) correctly reported a single match. It does so by routing column-index searches through the existing structured buildDataAssetSearchBuilderV2 path so tableColumn uses its AssetTypeConfiguration (including fqnParts with AND semantics), and it adds unit + integration coverage to prevent regressions.

Changes:

  • Route isColumnIndex(indexName) searches through buildDataAssetSearchBuilderV2(...) for both OpenSearch and Elasticsearch factories.
  • Remove the now-unused permissive buildColumnSearchBuilderV2 implementations (and related ColumnSearchIndex imports).
  • Add unit and integration tests verifying tableColumn queries include fqnParts + "operator":"and" and that FQN searches return exactly 1 hit.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java Route column-index queries through the structured data-asset builder; remove old column-specific builder.
openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java Same routing/removal as OpenSearch for Elasticsearch queries.
openmetadata-service/src/test/java/org/openmetadata/service/search/SearchSourceBuilderFactoryTest.java Add unit test asserting tableColumn builder emits fqnParts and AND operator (both engines).
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/ColumnSearchIndexIT.java Add OpenSearch integration test ensuring full column FQN search is precise (total == 1 and correct hit).

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit c86319828bbbeb13dbfe69eec2866489b5d69647 in Playwright run 31107658385, attempt 1.

✅ 1026 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 57m 24s

⏱️ Max setup 3m 6s · max shard execution 17m 2s · max shard-job elapsed before upload 21m 40s · reporting 6s

🌐 189.14 requests/attempt · 2.21 app boots/UI scenario · 16.83% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 16.83% (convergence target: at most 15%).
  • Application boot ratio was 2.21 per UI scenario (2308 boots / 1042 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 155 0 0 0 0 0
✅ Shard chromium-02 138 0 0 0 0 0
✅ Shard chromium-03 136 0 0 0 0 0
✅ Shard chromium-04 143 0 0 0 0 0
✅ Shard chromium-05 137 0 0 0 0 0
✅ Shard chromium-06 131 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 7 0 0 0 0 0
✅ Shard ingestion-01 2 0 0 0 0 0
✅ Shard reindex-01 28 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@mohityadav766 mohityadav766 self-assigned this Aug 6, 2026
Copilot AI review requested due to automatic review settings August 6, 2026 13:48

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@mohityadav766
mohityadav766 added this pull request to the merge queue Aug 6, 2026
Merged via the queue into main with commit f6d0eb4 Aug 7, 2026
115 of 117 checks passed
@mohityadav766
mohityadav766 deleted the fix/column-search-use-structured-builder branch August 7, 2026 00:34
@gitar-bot

gitar-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Routes column search queries through the structured builder with fqnParts and AND logic, aligning the result list with aggregations and fixing search count mismatches. No issues found.

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 👍 / 👎 | Gitar | Powered by Gitar — free for open source

mohityadav766 added a commit that referenced this pull request Aug 7, 2026
…unts match results (#31106) (#31207)

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) <noreply@anthropic.com>
mohityadav766 added a commit that referenced this pull request Aug 7, 2026
…unts match results (#31106) (#31208)

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.


(cherry picked from commit f6d0eb4)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
harshach added a commit that referenced this pull request Aug 8, 2026
…le hit

testColumnFqnSearchIsPrecise asserted that searching a column's full FQN
returns exactly one hit. The tableColumn ranking configuration cannot deliver
that: its stages are should-clauses with minimum_should_match "2<70%" over
name/fqnParts/table.name, and a sibling column in the same table shares every
FQN token except its own name, so it clears 70% and matches by construction.
The CI response showed 8 hits - the 3 columns of the table under test plus the
user_id column of 5 sibling tests, all matching the structuralContext stage.

The assertion also could not be reached by the path it described: a plain FQN
has no query syntax, so containsQuerySyntax is false and the query never takes
the operator-AND branch the comment referred to; it goes through the ranked
simple-query path instead.

Assert the property the fix in #31106 actually restored - the count backing the
Explore Columns tab agrees with the results beneath it, and the exact FQN ranks
first - and keep a bound that still catches the original fan-out (that bug
returned 7381 hits for one FQN). Verified by replaying all three assertions
against the recorded failing response.

Making an exact-FQN column query isolating would be a change to the search
relevance settings rather than to this test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

4 participants