Skip to content

Commit 4dfe32b

Browse files
committed
fix(java): update browse iterator
1 parent f29dfa7 commit 4dfe32b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/java/api_helpers.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public Iterable<SynonymHit> browseSynonyms(String indexName, SearchSynonymsParam
347347
return AlgoliaIterableHelper.createIterable(
348348
() -> {
349349
SearchSynonymsResponse response = this.searchSynonyms(indexName, params, requestOptions);
350-
currentPage.value = response.getNbHits() < params.getHitsPerPage() ? null : currentPage.value + 1;
350+
currentPage.value = response.getPage() + 1 <= response.getNbPages() ? null : currentPage.value + 1;
351351
return response.getHits().iterator();
352352
},
353353
() -> currentPage.value != null
@@ -389,7 +389,7 @@ public Iterable<Rule> browseRules(String indexName, SearchRulesParams params, Re
389389
return AlgoliaIterableHelper.createIterable(
390390
() -> {
391391
SearchRulesResponse response = this.searchRules(indexName, params.setPage(currentPage.value), requestOptions);
392-
currentPage.value = response.getNbHits() < hitsPerPage ? null : currentPage.value + 1;
392+
currentPage.value = response.getPage() + 1 <= response.getNbPages() ? null : currentPage.value + 1;
393393
return response.getHits().iterator();
394394
},
395395
() -> currentPage.value != null

0 commit comments

Comments
 (0)