Skip to content

Commit e654d48

Browse files
algolia-botFluf22
andcommitted
fix(clients): update browse iterator (generated)
algolia/api-clients-automation#4058 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent 9397d8c commit e654d48

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

algoliasearch/src/main/java/com/algolia/api/SearchClient.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6126,6 +6126,10 @@ public GetApiKeyResponse waitForApiKey(String key, ApiKeyOperation operation) {
61266126
public <T> Iterable<T> browseObjects(String indexName, BrowseParamsObject params, Class<T> innerType, RequestOptions requestOptions) {
61276127
final Holder<String> currentCursor = new Holder<>();
61286128

6129+
if (params.getHitsPerPage() == null) {
6130+
params.setHitsPerPage(1000);
6131+
}
6132+
61296133
return AlgoliaIterableHelper.createIterable(
61306134
() -> {
61316135
BrowseResponse<T> response = this.browse(indexName, params, innerType, requestOptions);
@@ -6175,7 +6179,7 @@ public Iterable<SynonymHit> browseSynonyms(String indexName, SearchSynonymsParam
61756179
return AlgoliaIterableHelper.createIterable(
61766180
() -> {
61776181
SearchSynonymsResponse response = this.searchSynonyms(indexName, params, requestOptions);
6178-
currentPage.value = response.getNbHits() < params.getHitsPerPage() ? null : currentPage.value + 1;
6182+
currentPage.value = response.getHits().size() < params.getHitsPerPage() ? null : currentPage.value + 1;
61796183
return response.getHits().iterator();
61806184
},
61816185
() -> currentPage.value != null
@@ -6217,7 +6221,7 @@ public Iterable<Rule> browseRules(String indexName, SearchRulesParams params, Re
62176221
return AlgoliaIterableHelper.createIterable(
62186222
() -> {
62196223
SearchRulesResponse response = this.searchRules(indexName, params.setPage(currentPage.value), requestOptions);
6220-
currentPage.value = response.getNbHits() < hitsPerPage ? null : currentPage.value + 1;
6224+
currentPage.value = response.getHits().size() < hitsPerPage ? null : currentPage.value + 1;
62216225
return response.getHits().iterator();
62226226
},
62236227
() -> currentPage.value != null

0 commit comments

Comments
 (0)