Skip to content

Commit

Permalink
fix: exception on global search sometimes (#14455)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek332 authored Dec 21, 2023
1 parent 3a51f0b commit c9a00f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

import { SortingField } from '../components/Explore/SortingDropDown';
import { SearchIndex } from '../enums/search.enum';
import i18n from '../utils/i18next/LocalUtil';

export const INITIAL_SORT_FIELD = 'updatedAt';
Expand Down Expand Up @@ -57,3 +58,18 @@ export const COMMON_FILTERS_FOR_DIFFERENT_TABS = [
'owner.displayName',
'tags.tagFQN',
];

export const TABS_SEARCH_INDEXES = [
SearchIndex.TABLE,
SearchIndex.STORED_PROCEDURE,
SearchIndex.DASHBOARD,
SearchIndex.DASHBOARD_DATA_MODEL,
SearchIndex.PIPELINE,
SearchIndex.TOPIC,
SearchIndex.MLMODEL,
SearchIndex.CONTAINER,
SearchIndex.SEARCH_INDEX,
SearchIndex.GLOSSARY,
SearchIndex.TAG,
SearchIndex.DATA_PRODUCT,
];
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { getExplorePath, PAGE_SIZE } from '../../constants/constants';
import {
COMMON_FILTERS_FOR_DIFFERENT_TABS,
INITIAL_SORT_FIELD,
TABS_SEARCH_INDEXES,
} from '../../constants/explore.constants';
import {
mockSearchData,
Expand Down Expand Up @@ -341,8 +342,9 @@ const ExplorePageV1: FunctionComponent = () => {
}).then((res) => {
const buckets = res.aggregations[`index_count`].buckets;
const counts: Record<string, number> = {};

buckets.forEach((item) => {
if (item) {
if (item && TABS_SEARCH_INDEXES.includes(item.key)) {
counts[item.key ?? ''] = item.doc_count;
}
});
Expand Down

0 comments on commit c9a00f3

Please sign in to comment.