Minor: Add name field in the advanced search fields list (#18399)

* Add name field in the advanced search fields list

* Update the search index for autocomplete for name DisplayName

* removed unnecessary array for searchIndex
This commit is contained in:
Aniket Katkar 2024-10-24 21:09:32 +05:30 committed by GitHub
parent 4083838056
commit 4d1ebb31c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 1 deletions

View File

@ -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',

View File

@ -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',
]);
});
});

View File

@ -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'),