Skip to content

Fixes #38006: use data-asset queries for page search - #38007

Open
likawa3b wants to merge 3 commits into
open-metadata:mainfrom
likawa3b:codex/fix-page-search-query-routing
Open

likawa3b wants to merge 3 commits into
open-metadata:mainfrom
likawa3b:codex/fix-page-search-query-routing

Conversation

@likawa3b

@likawa3b likawa3b commented Nov 17, 2026 •

Copy link
Copy Markdown

Describe your changes:

Fixes #38006

A Knowledge Center page titled What are the vacation options? can be found by the default data-asset search but return no hits when the search is scoped to page. Page indices fall through to the aggregate builder, whose complex-query path lacks the analyzed literal-match branch used by data-asset searches.

Add page and knowledge_page_search_index to the existing data-asset classifier and map both to the existing page search configuration. Define the page index string once as a private constant shared by both switches. These helper changes fix the routing for Elasticsearch and OpenSearch. Query text, Lucene syntax, MCP parameters, authorization, schemas and index mappings are unchanged.

Type of change:

  • Bug fix

High-level design:

N/A — small fix to existing switch cases. No new setting, migration or reindex is required.

Page-scoped free text and aggregation matching now use the existing configured page fields (name, displayName, description, fullyQualifiedName, fqnParts and their configured variants), and page search uses its pageType aggregation. This replaces the aggregate path's all-fields matching and aggregate facets, so matches confined to other fields and facet output can change.

Tests:

Use cases covered

  • Both page aliases resolve the page configuration and select the data-asset builder on both backends.
  • A natural question ending in ? finds the expected page, as does the same question without the trailing question mark.
  • An intentional name:<topic>* query still finds that page.

Unit tests

Updated SearchUtilsTest and SearchSourceBuilderFactoryTest.

  • Before the fix: 202 tests, 8 new page cases fail, 194 existing cases pass.
  • After the fix: 574 tests pass in 15 classes, including the two changed classes and related search, aggregation/RBAC, private-field, Lucene-syntax, lineage and repository utility tests. No failures, errors or skips.
  • Java 21 / Maven 3.9.9; scoped spotless:apply and spotless:check pass.
  • JaCoCo 0.8.13, measured on the behavioural fix at d47e27f2: SearchUtils line coverage is 288/369 (78.05%) for the selected run; isDataAssetIndex has 100% line coverage and the added page mapping is covered. Full-suite coverage was not measured.

Backend integration tests

Updated KnowledgePageHierarchyIT with testPageSearchMatchesQuestionAndPreservesLuceneSyntax, parameterized over page and knowledge_page_search_index with distinct page names.

Manual local validation against isolated Testcontainers stacks, on the behavioural fix at d47e27f2:

Profile Complete KnowledgePageHierarchyIT result
postgres-opensearch (PostgreSQL 15 / OpenSearch 3.4.0) 9 passed, 0 failures/errors/skips
mysql-elasticsearch (MySQL 8.3.0 / Elasticsearch 9.3.0) 9 passed, 0 failures/errors/skips

On unpatched main, the HTTP regression for the page alias returns an empty hit list for the question ending in ?; the fixed run finds the expected page. Both alias invocations pass after the fix.

The subsequent constant extraction only replaces the two identical string literals with one private compile-time constant. Expanding it reproduces the tested source exactly; the 574 unit tests and Spotless were rerun after that extraction.

The impact planner's branch ownership check passes. The full impacted integration/nightly plan and full service unit suite remain not run; these focused results establish PR review readiness, not merge readiness.

The upstream metadata check still needs maintainer triage: issue #38006 must be added to the Shipping project with its required Status, Source, Priority, Domain and Release fields. The current contributor authentication has no project scope, so that project setup has not been performed here.

Integration validation commands

Run sequentially for each profile above:

mvn -B verify -pl :openmetadata-integration-tests -am \
  -Ppostgres-opensearch \
  -DintegrationTests.lane=parallel -Dit.test=KnowledgePageHierarchyIT \
  -Dfailsafe.failIfNoSpecifiedTests=false \
  -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false \
  -Dspring-boot.repackage.skip=true \
  -Djsonschema2pojo.skip=true -Dexec.skip=true \
  -Dmaven.compiler.useIncrementalCompilation=false \
  -Dspotless.check.skip=true -Dresolve.skip=true

The second run replaces -Ppostgres-opensearch with -Pmysql-elasticsearch. Generated models, scripts and Swagger outputs were reused from the preceding full reactor build; formatting was checked separately.

Ingestion integration tests

N/A — no ingestion changes.

Playwright (UI) tests

N/A — no UI changes.

Visual regression baselines

N/A — no rendering changes.

Manual testing performed

No separate manual UI test. The automated HTTP regression creates synthetic articles and verifies the returned page identity against each real search backend.

UI screen recording:

N/A — backend-only bug fix.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
  • Decision check: if this PR decides something the next contributor could undo — a schema field, REST path or format another component or repo must agree with, a new default or limit, an ordering that must hold, or a rule stated only in this description — it adds a record under docs/decisions/ (see its README.md). This description is gone from git log after the squash-merge.
  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

Self-reviewed 32a204c3, including callers of both shared helpers and both backend implementations; no unresolved important findings. This follows related fixes #33655 and #35440. The switch additions need no explanatory code comment. No new contract, setting or decision record is introduced; schema, migration and UI requirements are not applicable for the reasons above.

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge; no blocking issues were found.

Summary

Page searches now use the existing data-asset query builders and page settings on Elasticsearch and OpenSearch. The latest commit shares the page index name through one private constant without changing behavior.

  • Page searches now use their configured page fields and facets.

Tests were not rerun during this review.

Reviews (2) · Last reviewed commit: "refactor: share the page search index na..." · Reviewed by Greptile

Use the existing data-asset query path and page search configuration for Knowledge Center pages. This retains literal matches for question titles while preserving Lucene syntax on both search backends.
@likawa3b
likawa3b marked this pull request as ready for review November 17, 2026 21:07
@likawa3b
likawa3b requested a review from a team as a code owner November 17, 2026 21:07
@likawa3b
likawa3b requested a review from sonika-shah November 17, 2026 21:07
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 skip-pr-checks label.

Use one compile-time constant in both routing switches to follow the Java contribution guide and keep their index names aligned.
@gitar-bot

gitar-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Routing page searches through the data-asset builder changes searchable fields and facets, so pages matching only excluded fields may no longer appear.

Routes page and knowledge_page_search_index searches through the data-asset query builder so question-title searches such as What are the vacation options? return hits on both Elasticsearch and OpenSearch. Resolved the parameterized integration test collision where the same page name caused a 409 on the second run. No open issues found.

✅ 1 closed
✅ Bug: Parameterized IT runs create the same page name, so the second gets a 409

📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/KnowledgePageHierarchyIT.java:76-83
TestNamespaceExtension.beforeEach builds methodId from getRequiredTestMethod().getName() alone. It only adds a suffix for @RetryingTest, so both @ValueSource invocations (page and knowledge_page_search_index) get the same ns.prefix("vacation"). Each invocation POSTs a top-level page with that name through RestClient.create, and nothing tracks the page for cleanup. Whichever invocation runs second (sequentially or under @Execution(CONCURRENT)) hits a duplicate-entity conflict before it ever searches, so the test can't pass for both aliases. The fix is to put the index in the name, e.g. ns.prefix("vacation_" + index), or to create the page once and run the search checks for each alias against it.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@likawa3b

Copy link
Copy Markdown
Author

Hi @sonika-shah, could you add #38006 to the Shipping project, fill in the required Status, Source, Priority, Domain, and Release fields, and rerun the Validate PR Metadata check?

Could you also review this PR when you have a chance? It fixes the Knowledge Center page search regression on both Elasticsearch and OpenSearch. The PR description includes the regression test results.

Thank you!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Knowledge Center page searches lose question-title matches

2 participants