Skip to content

Fixes #27482: Fix Advanced Search between boundaries for custom numerical properties#27486

Open
aniruddhaadak80 wants to merge 1 commit intoopen-metadata:mainfrom
aniruddhaadak80:fix-advanced-search-between-number-27482
Open

Fixes #27482: Fix Advanced Search between boundaries for custom numerical properties#27486
aniruddhaadak80 wants to merge 1 commit intoopen-metadata:mainfrom
aniruddhaadak80:fix-advanced-search-between-number-27482

Conversation

@aniruddhaadak80
Copy link
Copy Markdown

@aniruddhaadak80 aniruddhaadak80 commented Apr 17, 2026

Describe your changes:

Fixes #27482

I worked on QueryBuilderElasticsearchFormatUtils.js because the RAQB between boundaries (i.e. [10, 20]) were incorrectly stripped of the upper bound during buildExtensionQuery. This passes the entire bounding Array correctly, repairing Advanced Search filtering.

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • 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.

Summary by Gitar

  • Refactored type resolution:
    • Introduced getFieldTypeInfoFromOmType and lookupOmPropertyType to use registry configuration for unambiguous field mapping.
  • Improved precision:
    • Updated field identification logic from includes() to endsWith() to prevent misclassification of properties containing dots in their names.
    • Enhanced numeric value detection in buildExtensionQuery by leveraging omPropertyType metadata instead of relying solely on value-shape parsing.

This will update automatically on new commits.

@aniruddhaadak80 aniruddhaadak80 requested a review from a team as a code owner April 17, 2026 14:49
Copilot AI review requested due to automatic review settings April 17, 2026 14:49
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes Advanced Search formatting for custom numeric property between filters by ensuring the full boundary array is passed through to the extension/customPropertiesTyped query builder, so Elasticsearch DSL can include both gte and lte.

Changes:

  • Pass the complete value array (instead of value[0]) when building extension-field queries, allowing between to retain both bounds.

Comment on lines 739 to 745
return buildExtensionQuery(
extensionPropertyName,
entityType,
hasValue ? value[0] : null,
hasValue ? value : null,
op,
not
);
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

This change fixes the range-boundary bug, but there’s no regression test covering the advanced-search → Elasticsearch DSL formatting for extension numeric properties with the between operator (i.e., verifying both gte and lte are emitted and change when the second boundary changes). Please add a unit test around elasticSearchFormatForJSONLogic/buildExtensionQuery for an extension.<entity>.<property> field using between to prevent this from regressing again.

Copilot uses AI. Check for mistakes.
@aniruddhaadak80 aniruddhaadak80 changed the title Fix Advanced Search 'between' boundaries for custom numerical properties (#27482) Fixes #27482: Fix Advanced Search between boundaries for custom numerical properties Apr 17, 2026
@aniruddhaadak80
Copy link
Copy Markdown
Author

aniruddhaadak80 commented Apr 17, 2026

hi maintainers could someone please add the safe to test label so the pipelines can run, thank you

@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Copy link
Copy Markdown
Author

@aniruddhaadak80 aniruddhaadak80 left a comment

Choose a reason for hiding this comment

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

Added explicit unit test for advanced-search extension numeric properties with the between operator as requested. Synced up with main.

Copilot AI review requested due to automatic review settings April 21, 2026 17:21
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 2 out of 2 changed files in this pull request and generated 2 comments.

@@ -0,0 +1,45 @@
import { elasticSearchFormatForJSONLogic } from './QueryBuilderElasticsearchFormatUtils';
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

New test file is missing the standard Apache 2.0 license header block that other UI source/test files include (e.g., APIUtils.test.js). Please add the repository’s license header at the top of this file to satisfy license-header checks.

Copilot uses AI. Check for mistakes.
};

// The method elasticSearchFormatForJSONLogic internally uses tree.get()
const result = elasticSearchFormatForJSONLogic(tree, config);
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

This test calls elasticSearchFormatForJSONLogic(), but that function currently references an undeclared extendConfig (it isn’t imported/defined in QueryBuilderElasticsearchFormatUtils.js). In a Jest/module context this will throw and the catch block will return {}, making the assertions fail or the test not exercise the real formatting logic. Either switch the test to use elasticSearchFormat() (the function used by the app), or update elasticSearchFormatForJSONLogic to use extendConfigUtils.ConfigUtils.extendConfig like elasticSearchFormat does.

Copilot uses AI. Check for mistakes.
@aniruddhaadak80 aniruddhaadak80 force-pushed the fix-advanced-search-between-number-27482 branch from 0974b36 to 0e77d3d Compare April 22, 2026 05:40
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 22, 2026

Code Review ✅ Approved 2 resolved / 2 findings

Refactored Advanced Search logic to correctly handle boundaries for numerical properties, addressing fragile string matching and adding coverage for the missing not_between operator.

✅ 2 resolved
Quality: Test uses fragile string matching instead of structure assertions

📄 openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderElasticsearchFormatUtils.test.js:38-43
The test serializes the result to JSON and uses toContain on the string to verify the query structure. This is brittle — it will pass even if gte/lte appear in unexpected places in the output, and it will break if JSON key ordering or whitespace changes.

Consider asserting on the actual object structure instead, which is more readable and gives better failure messages.

Edge Case: Missing test for not_between operator

📄 openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderElasticsearchFormatUtils.test.js:1-15
The not_between operator is also a range operator that uses the same array value pattern as between. It would be good to add a test case for it to ensure the negation logic works correctly with the full value array now being passed through.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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

Labels

None yet

Projects

None yet

2 participants