flattenCategories

Function

Flatten categories as expected by Hub

  • flattenCategories(categoriesAggs: any) : any

Parameters

Parameter Type Default Notes
categoriesAggs Optional any []

categories aggs array as [{ key, docCount }]

Returns

Input example: [{ key: '/categories/economy', docCount: 4 }, { key: 'categories/economy/business', docCount: 5 }] Output: [{ key: 'economy', docCount: 9 }, { key: 'business', docCount: 5 }]

any

Function defined in search/src/ago/helpers/aggs/categories.ts:11