From 2a27d0793621e76e94c86f305853b5060eb7f830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Tue, 9 Apr 2024 13:11:15 +0200 Subject: [PATCH] CSW / GetRecords / Number of matches is not total match Follow up of https://github.com/geonetwork/core-geonetwork/pull/7599 `result.hits().hits().size()` returns number of records in response, not total hits matching search. `numberOfRecordsMatched` is wrong. ``` (), startPos-1, maxRecords, sort); List hits = result.hits().hits(); - - long numMatches = result.hits().hits().size(); + + TotalHits total = result.hits().total(); + long numMatches = total != null ? total.value() : 0; if (numMatches != 0 && startPos > numMatches) { throw new InvalidParameterValueEx("startPosition", String.format(