Skip to content

Commit

Permalink
Fix bug extracting totalResults
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed May 24, 2024
1 parent e6bcc96 commit 45dc7ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jsonld_serializers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit 45dc7ca

Please sign in to comment.