Skip to content

Commit

Permalink
fix error with empty buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
TIL-EBP committed Nov 6, 2024
1 parent 5382dd1 commit dfe0c6c
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,16 @@ export class AssetSearchService {
value: bucket.key,
count: bucket.doc_count,
});
console.log(JSON.stringify(aggs, null, 2));
return {
total,
assetKindItemCodes: aggs.assetKindItemCodes.a.buckets.map(mapBucket),
authorIds: aggs.authorIds.a.buckets.map(mapBucket),
languageItemCodes: aggs.languageItemCodes.a.buckets.map(mapBucket),
geometryCodes: aggs.geometryCodes.a.buckets.map(mapBucket),
manCatLabelItemCodes: aggs.manCatLabelItemCodes.a.buckets.map(mapBucket),
usageCodes: aggs.usageCodes.a.buckets.map(mapBucket),
workgroupIds: aggs.workgroupIds.a.buckets.map(mapBucket),
assetKindItemCodes: aggs.assetKindItemCodes?.a?.buckets?.map(mapBucket) ?? [],
authorIds: aggs.authorIds?.a?.buckets?.map(mapBucket) ?? [],
languageItemCodes: aggs.languageItemCodes?.a?.buckets?.map(mapBucket) ?? [],
geometryCodes: aggs.geometryCodes?.a?.buckets?.map(mapBucket) ?? [],
manCatLabelItemCodes: aggs.manCatLabelItemCodes?.a?.buckets?.map(mapBucket) ?? [],
usageCodes: aggs.usageCodes?.a?.buckets?.map(mapBucket) ?? [],
workgroupIds: aggs.workgroupIds?.a?.buckets?.map(mapBucket) ?? [],
createDate: {
min: dateFromDateId(aggs.minCreateDate.a.value),
max: dateFromDateId(aggs.maxCreateDate.a.value),
Expand Down

0 comments on commit dfe0c6c

Please sign in to comment.