mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-11 12:12:55 +00:00
refactor: omit useless facets in response
This commit is contained in:
@@ -63,7 +63,7 @@ export function parseAggregations(
|
|||||||
const realField = realType[fieldName];
|
const realField = realType[fieldName];
|
||||||
|
|
||||||
// this should always be true in theory...
|
// this should always be true in theory...
|
||||||
if (isESTermsFilter(field) && isBucketAggregation(realField)) {
|
if (isESTermsFilter(field) && isBucketAggregation(realField) && realField.buckets.length > 0) {
|
||||||
facets.push({
|
facets.push({
|
||||||
buckets: realField.buckets.map((bucket) => {
|
buckets: realField.buckets.map((bucket) => {
|
||||||
return {
|
return {
|
||||||
@@ -79,7 +79,7 @@ export function parseAggregations(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// the last part here means that it is a bucket aggregation
|
// the last part here means that it is a bucket aggregation
|
||||||
} else if (isESTermsFilter(type) && !isNestedAggregation(realType)) {
|
} else if (isESTermsFilter(type) && !isNestedAggregation(realType) && realType.buckets.length > 0) {
|
||||||
facets.push({
|
facets.push({
|
||||||
buckets: realType.buckets.map((bucket) => {
|
buckets: realType.buckets.map((bucket) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user