diff --git a/projects/rero/ng-core/src/lib/record/record.service.ts b/projects/rero/ng-core/src/lib/record/record.service.ts index 8d7829ed5..92c955061 100644 --- a/projects/rero/ng-core/src/lib/record/record.service.ts +++ b/projects/rero/ng-core/src/lib/record/record.service.ts @@ -101,6 +101,7 @@ export class RecordService { * a string or a list of string to filter with multiple values. * @param headers - HttpHeaders optional http header for the backend call. * @param sort - parameter for sorting records (eg. 'mostrecent' or '-mostrecent') + * @param facets - list of strings, define which aggregations/facets should be included into the response. */ getRecords( type: string, @@ -110,7 +111,8 @@ export class RecordService { aggregationsFilters: any[] = [], preFilters: object = {}, headers: any = null, - sort: string = null + sort: string = null, + facets: string[] = [] ): Observable { // Build query string let httpParams = new HttpParams().set('q', query); @@ -140,6 +142,10 @@ export class RecordService { } } + // facets management + // if array `facets` is an empty array, no aggregations data will be included into response.s + httpParams = httpParams.append('facets', facets.join(',')); + // http request with headers return this._http .get(this._apiService.getEndpointByType(type, true) + '/', {