Skip to content

Fixes #27482: Advanced Search between filter for number custom properties#27497

Open
himanshu748 wants to merge 2 commits intoopen-metadata:mainfrom
himanshu748:hackathon/fixes-27482-advanced-search-between
Open

Fixes #27482: Advanced Search between filter for number custom properties#27497
himanshu748 wants to merge 2 commits intoopen-metadata:mainfrom
himanshu748:hackathon/fixes-27482-advanced-search-between

Conversation

@himanshu748
Copy link
Copy Markdown

Describe your changes:

Fixes #27482

Advanced Search was incorrectly handling nested array values for range operators on custom properties. The Query Builder represents between values as [[from, to]], but the formatter treated any nested array as a multiselect and split it into multiple rules. This dropped the upper bound and produced an effectively unbounded query.

This change:

  • Only expands nested arrays into multiple rules for multiselect operators
  • Passes the full [from, to] bounds through to the customPropertiesTyped range builder

Testing

  • Added unit coverage asserting the generated Elasticsearch query includes both gte and lte for a number custom property between filter.

Type of change:

  • Bug fix

Checklist:

Hackathon / AI disclosure

Built with Cursor (AI-assisted) and manually reviewed.

Made with Cursor

Prevent range operators (between/not_between) from being treated like multiselect values and ensure both bounds are passed through when building customPropertiesTyped queries.

Made-with: Cursor
Copilot AI review requested due to automatic review settings April 17, 2026 18:52
@himanshu748 himanshu748 requested a review from a team as a code owner April 17, 2026 18:52
@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 Elasticsearch query generation for custom property between (range) filters by preventing nested array values from being incorrectly expanded into multiple rules, ensuring both bounds are preserved.

Changes:

  • Restrict nested-array expansion to multiselect/select operators only, avoiding range operator (between) corruption.
  • Preserve full [from, to] bounds when building custom property extension queries.
  • Add a unit test asserting gte + lte are present for a number custom property between filter.

Reviewed changes

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

File Description
openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderElasticsearchFormatUtils.js Adjusts nested-array handling so between values are not split into separate rules; ensures bounded range queries for custom properties.
openmetadata-ui/src/main/resources/ui/src/utils/QueryBuilderElasticsearchFormatUtils.test.ts Adds unit coverage for bounded range query generation for number custom properties using between.

Comment on lines +15 to +16
import { SearchIndex } from '../enums/search.enum';
import { SearchOutputType } from '../generated/type/searchOutputType';
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.

SearchOutputType is imported from ../generated/type/searchOutputType, but there is no such generated file in the repo and the app code uses the enum from components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.interface. This will break the test build and also risks comparing different enum instances in getTreeConfig.

Suggested change
import { SearchIndex } from '../enums/search.enum';
import { SearchOutputType } from '../generated/type/searchOutputType';
import { SearchOutputType } from '../components/Explore/AdvanceSearchProvider/AdvanceSearchProvider.interface';
import { SearchIndex } from '../enums/search.enum';

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +40
const config = getTreeConfig({
searchOutputType: SearchOutputType.ElasticSearch,
searchIndex: SearchIndex.TABLE,
isExplorePage: true,
});

const jsonTree = {
id: 'root',
type: 'group',
properties: { conjunction: 'AND', not: false },
children1: {
rules: {
type: 'rule',
id: 'rules',
properties: {
field: 'extension.table.myNumberProperty',
operator: 'between',
value: [[1, 5]],
valueSrc: ['value'],
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.

The base config returned by getTreeConfig() initializes fields.extension.subfields as {} (custom properties are injected later at runtime). With no extension.table.myNumberProperty field present, QbUtils.checkTree() is likely to drop/neutralize this rule, making the test unreliable. Consider injecting minimal config.fields.extension.subfields for table -> myNumberProperty (type number, operators NUMBER_FIELD_OPERATORS) before calling checkTree.

Copilot uses AI. Check for mistakes.
@himanshu748
Copy link
Copy Markdown
Author

Hi! This PR is ready for CI. Could a maintainer please add the safe to test label so the workflows can run? (They currently fail at the PR-label gate.) Thanks!

@himanshu748
Copy link
Copy Markdown
Author

Addressed Copilot review notes in the new unit test: (1) import SearchOutputType from AdvanceSearchProvider.interface (app source), and (2) inject a minimal extension.table.myNumberProperty field into the QB config so QbUtils.checkTree() keeps the rule.

@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 17, 2026

Code Review ✅ Approved

Advanced search functionality now supports range filtering for number-based custom properties, addressing the requested feature requirements. No issues found.

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