mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-03 06:03:12 +00:00
Fixed Search filter issues (#2197)
This commit is contained in:
parent
5714c4122b
commit
ad362a31fd
@ -15,6 +15,7 @@ import classNames from 'classnames';
|
|||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import {
|
import {
|
||||||
AggregationType,
|
AggregationType,
|
||||||
|
Bucket,
|
||||||
FilterObject,
|
FilterObject,
|
||||||
FormatedTableData,
|
FormatedTableData,
|
||||||
SearchResponse,
|
SearchResponse,
|
||||||
@ -169,18 +170,21 @@ const Explore: React.FC<ExploreProps> = ({
|
|||||||
for (const newAgg of newAggregations) {
|
for (const newAgg of newAggregations) {
|
||||||
for (const oldAgg of oldAggs) {
|
for (const oldAgg of oldAggs) {
|
||||||
if (newAgg.title === oldAgg.title) {
|
if (newAgg.title === oldAgg.title) {
|
||||||
for (const oldBucket of oldAgg.buckets) {
|
const buckets = cloneDeep(oldAgg.buckets)
|
||||||
let docCount = 0;
|
.map((item) => {
|
||||||
for (const newBucket of newAgg.buckets) {
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||||
if (newBucket.key === oldBucket.key) {
|
return { ...item, doc_count: 0 };
|
||||||
docCount = newBucket.doc_count;
|
})
|
||||||
|
.concat(newAgg.buckets);
|
||||||
|
const bucketHashmap = buckets.reduce((obj, item) => {
|
||||||
|
obj[item.key]
|
||||||
|
? // eslint-disable-next-line @typescript-eslint/camelcase
|
||||||
|
(obj[item.key].doc_count += item.doc_count)
|
||||||
|
: (obj[item.key] = { ...item });
|
||||||
|
|
||||||
break;
|
return obj;
|
||||||
}
|
}, {} as { [key: string]: Bucket });
|
||||||
}
|
oldAgg.buckets = Object.values(bucketHashmap);
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
oldBucket.doc_count = docCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -505,7 +509,7 @@ const Explore: React.FC<ExploreProps> = ({
|
|||||||
'tags'
|
'tags'
|
||||||
);
|
);
|
||||||
const aggDatabase = getAggregationList(
|
const aggDatabase = getAggregationList(
|
||||||
searchResult.resAggTag.data.aggregations,
|
searchResult.resAggDatabase.data.aggregations,
|
||||||
'database'
|
'database'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user