From 45dc7cac9bf5ba936af621932e42eac109a562e0 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Fri, 24 May 2024 13:51:55 -0400 Subject: [PATCH] Fix bug extracting totalResults --- lib/jsonld_serializers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jsonld_serializers.js b/lib/jsonld_serializers.js index a64c421a..5517223b 100644 --- a/lib/jsonld_serializers.js +++ b/lib/jsonld_serializers.js @@ -401,7 +401,7 @@ class ResourceResultsSerializer extends SearchResultsSerializer { static serialize (resp, opts) { const results = resp.hits.hits.map((h) => ({ score: h._score, record: ResourceSerializer.serialize(h._source) })) - opts = Object.assign({ extraRootProperties: { totalResults: resp.hits.total } }, opts) + opts = Object.assign({ extraRootProperties: { totalResults: resp.hits.total?.value || resp.hits.total } }, opts) return (new ResourceResultsSerializer(results, opts)).format() } }