mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-03 20:12:51 +00:00
refactor: provide 'onlyOnType' facet field only if defined
This commit is contained in:
committed by
Rainer Killinger
parent
7d4c27ec26
commit
8dbb3ca19a
@@ -64,7 +64,7 @@ export function parseAggregations(
|
||||
|
||||
// this should always be true in theory...
|
||||
if (isESTermsFilter(field) && isBucketAggregation(realField) && realField.buckets.length > 0) {
|
||||
facets.push({
|
||||
const facet: SCFacet = {
|
||||
buckets: realField.buckets.map((bucket) => {
|
||||
return {
|
||||
count: bucket.doc_count,
|
||||
@@ -72,9 +72,12 @@ export function parseAggregations(
|
||||
};
|
||||
}),
|
||||
field: fieldName,
|
||||
onlyOnType: isESAggMatchAllFilter(type.filter)
|
||||
? undefined : type.filter.type.value as SCThingType,
|
||||
});
|
||||
};
|
||||
// if it's not for all types then create the appropriate field and set the type name
|
||||
if (!isESAggMatchAllFilter(type.filter)) {
|
||||
facet.onlyOnType = type.filter.type.value as SCThingType;
|
||||
}
|
||||
facets.push(facet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user