Skip to content

Commit b49cd3f

Browse files
mwjsandersfxprunayre
authored andcommitted
fix for nextrecord in csw getrecord response when using pagination
1 parent 0b4b994 commit b49cd3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/SearchController.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ public Element search(ServiceContext context, int startPos, int maxRecords,
489489
SearchResponse result = searchManager.query(esJsonQuery, new HashSet<>(), startPos - 1, maxRecords, sort);
490490

491491
List<Hit> hits = result.hits().hits();
492-
492+
493493
TotalHits total = result.hits().total();
494494
long numMatches = total != null ? total.value() : 0;
495495

@@ -529,7 +529,7 @@ public Element search(ServiceContext context, int startPos, int maxRecords,
529529
results.setAttribute("elementSet", setName.toString());
530530

531531

532-
if (numMatches > counter) {
532+
if (numMatches > counter + (startPos -1)) {
533533
results.setAttribute("nextRecord", Long.toString(counter + startPos));
534534
} else {
535535
results.setAttribute("nextRecord", "0");

0 commit comments

Comments
 (0)