Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 3b9e573

Browse files
Fix pagination issue where x-total header did not display total records
1 parent c65f710 commit 3b9e573

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/es-helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ async function searchUsers (authUser, filter, params) {
12821282
user.groups = groups
12831283
}
12841284

1285-
return { total: result.length, page: params.page, perPage: params.perPage, result }
1285+
return { total: getTotalCount(docs.hits.total), page: params.page, perPage: params.perPage, result }
12861286
}
12871287

12881288
async function searchAttributeValues ({ attributeId, attributeValue }) {
@@ -1294,7 +1294,7 @@ async function searchAttributeValues ({ attributeId, attributeValue }) {
12941294
return hit.inner_hits.attributes.hits.hits[0]._source
12951295
})
12961296

1297-
return { total: result.length, result: result }
1297+
return { total: getTotalCount(esResult.hits.total), result: result }
12981298
}
12991299

13001300
module.exports = {

0 commit comments

Comments
 (0)