diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js index 6b1bd9d0a49..264a149afa1 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AdvancedSearchQuickFilters.spec.js @@ -75,3 +75,78 @@ describe(`Advanced search quick filters should work properly for assets`, () => }); }); }); + +const testIsNullAndIsNotNullFilters = (operatorTitle, queryFilter, alias) => { + cy.sidebarClick('app-bar-item-explore'); + const asset = QUICK_FILTERS_BY_ASSETS[0]; + cy.get(`[data-testid="${asset.tab}"]`).scrollIntoView().click(); + cy.get('[data-testid="advance-search-button"]').click(); + + // Check Is Null or Is Not Null + cy.get('.rule--operator > .ant-select > .ant-select-selector').eq(0).click(); + cy.get(`[title="${operatorTitle}"]`).click(); + + cy.intercept('GET', '/api/v1/search/query?*', (req) => { + req.alias = alias; + }).as(alias); + + cy.get('[data-testid="apply-btn"]').click(); + + cy.wait(`@${alias}`).then((xhr) => { + const actualQueryFilter = JSON.parse(xhr.request.query['query_filter']); + + expect(actualQueryFilter).to.deep.equal(queryFilter); + }); +}; + +describe(`Advanced Search Modal`, () => { + beforeEach(() => { + cy.login(); + }); + + it('should check isNull and isNotNull filters', () => { + // Check Is Null + const isNullQuery = { + query: { + bool: { + must: [ + { + bool: { + must: [ + { + bool: { + must_not: { + exists: { field: 'owner.displayName.keyword' }, + }, + }, + }, + ], + }, + }, + ], + }, + }, + }; + testIsNullAndIsNotNullFilters('Is null', isNullQuery, 'searchAPI'); + + // Check Is Not Null + const isNotNullQuery = { + query: { + bool: { + must: [ + { + bool: { + must: [{ exists: { field: 'owner.displayName.keyword' } }], + }, + }, + ], + }, + }, + }; + testIsNullAndIsNotNullFilters( + 'Is not null', + isNotNullQuery, + 'newSearchAPI' + ); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx index 9ed0a111ba6..8d531745feb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreV1.component.tsx @@ -287,6 +287,7 @@ const ExploreV1: React.FC = ({ {(quickFilters || sqlQuery) && ( clearFilters()}> {t('label.clear-entity', { entity: '', diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/AdvancedSearch.constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/AdvancedSearch.constants.ts index f9ac603ca4e..eb62d5e33e5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/AdvancedSearch.constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/AdvancedSearch.constants.ts @@ -458,8 +458,6 @@ const getInitialConfigWithoutFields = () => { operators: ['like', 'not_like'], }, }, - // Removes NULL check operators - excludeOperators: ['is_null', 'is_not_null'], // Limits source to user input values, not other fields valueSources: ['value'], }, @@ -471,7 +469,6 @@ const getInitialConfigWithoutFields = () => { operators: ['like', 'not_like'], }, }, - excludeOperators: ['is_null', 'is_not_null'], valueSources: ['value'], }, text: {