From 5f724e6af1c7cedba9c098c68ea368b8db32b1ed Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Tue, 3 Dec 2024 11:32:15 -0500 Subject: [PATCH] update aggregations with recordTypeId --- lib/jsonld_serializers.js | 3 +++ lib/resources.js | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/jsonld_serializers.js b/lib/jsonld_serializers.js index 0cc003f4..f184a9d8 100644 --- a/lib/jsonld_serializers.js +++ b/lib/jsonld_serializers.js @@ -498,6 +498,9 @@ class AggregationSerializer extends JsonLdItemSerializer { } else if (field === 'buildingLocation') { // Build buildingLocation agg labels from nypl-core: v.label = locations[v.value]?.label + } else if (field === 'recordType') { + // Build buildingLocation agg labels from nypl-core: + v.label = recordTypes[v.value]?.label } else { v.label = v.value } diff --git a/lib/resources.js b/lib/resources.js index 0594f3ab..d0a60abd 100644 --- a/lib/resources.js +++ b/lib/resources.js @@ -32,6 +32,7 @@ const ITEM_FILTER_AGGREGATIONS = { // Configures aggregations: const AGGREGATIONS_SPEC = { + recordType: { terms: { field: 'recordTypeId' } }, buildingLocation: { terms: { field: 'buildingLocationIds' } }, owner: { nested: { path: 'items' }, aggs: { _nested: { terms: { field: 'items.owner_packed' } } } }, subjectLiteral: { terms: { field: 'subjectLiteral.raw' } },