diff --git a/openmetadata-ui/src/main/resources/ui/src/enums/AdvancedSearch.enum.ts b/openmetadata-ui/src/main/resources/ui/src/enums/AdvancedSearch.enum.ts index 99984cd6697..9af4bbe8dd4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/enums/AdvancedSearch.enum.ts +++ b/openmetadata-ui/src/main/resources/ui/src/enums/AdvancedSearch.enum.ts @@ -40,6 +40,7 @@ export enum EntityFields { ENTITY_TYPE = 'entityType', TABLE_TYPE = 'tableType', DISPLAY_NAME_KEYWORD = 'displayName.keyword', + NAME_KEYWORD = 'name.keyword', GLOSSARY = 'glossary.name.keyword', CLASSIFICATION = 'classification.name.keyword', DOMAIN = 'domain.displayName.keyword', diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.test.ts b/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.test.ts new file mode 100644 index 00000000000..19eb74840a4 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.test.ts @@ -0,0 +1,39 @@ +/* + * Copyright 2024 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { EntityFields } from '../enums/AdvancedSearch.enum'; +import { AdvancedSearchClassBase } from './AdvancedSearchClassBase'; + +describe('AdvancedSearchClassBase', () => { + let advancedSearchClassBase: AdvancedSearchClassBase; + + beforeEach(() => { + advancedSearchClassBase = new AdvancedSearchClassBase(); + }); + + it('getCommonConfig function should return expected fields', () => { + const result = advancedSearchClassBase.getCommonConfig({}); + + expect(Object.keys(result)).toEqual([ + EntityFields.DISPLAY_NAME_KEYWORD, + EntityFields.NAME_KEYWORD, + 'deleted', + EntityFields.OWNERS, + EntityFields.DOMAIN, + 'serviceType', + EntityFields.TAG, + EntityFields.TIER, + 'extension', + 'descriptionStatus', + ]); + }); +}); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.ts b/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.ts index 2cae0121790..ac91f66f694 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.ts @@ -451,7 +451,7 @@ class AdvancedSearchClassBase { mainWidgetProps: this.mainWidgetProps, fieldSettings: { asyncFetch: this.autocomplete({ - searchIndex: entitySearchIndex ?? [SearchIndex.DATA_ASSET], + searchIndex: SearchIndex.DATA_ASSET, entityField: EntityFields.DISPLAY_NAME_KEYWORD, }), useAsyncSearch: true, @@ -466,6 +466,27 @@ class AdvancedSearchClassBase { 'regexp', ], }, + [EntityFields.NAME_KEYWORD]: { + label: t('label.name'), + type: 'select', + mainWidgetProps: this.mainWidgetProps, + fieldSettings: { + asyncFetch: this.autocomplete({ + searchIndex: SearchIndex.DATA_ASSET, + entityField: EntityFields.NAME_KEYWORD, + }), + useAsyncSearch: true, + }, + operators: [ + 'select_equals', + 'select_not_equals', + 'select_any_in', + 'select_not_any_in', + 'like', + 'not_like', + 'regexp', + ], + }, deleted: { label: t('label.deleted'),