Skip to content

Commit d06fe56

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 601a9ce commit d06fe56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/algolia/api/search_client.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3201,6 +3201,8 @@ def wait_for_api_key(
32013201
# @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `browse` method.
32023202
# @param block [Proc] the block to execute on each object of the index.
32033203
def browse_objects(index_name, browse_params = Search::BrowseParamsObject.new, request_options = {}, &block)
3204+
browse_params[:hits_per_page] = browse_params[:hits_per_page] || 1000
3205+
32043206
hits = []
32053207
loop do
32063208
res = browse(index_name, browse_params, request_options)
@@ -3243,7 +3245,7 @@ def browse_rules(
32433245
end
32443246

32453247
search_rules_params.page += 1
3246-
break if res.nb_hits < search_rules_params.hits_per_page
3248+
break if res.hits.length < search_rules_params.hits_per_page
32473249
end
32483250

32493251
rules unless block_given?
@@ -3273,7 +3275,7 @@ def browse_synonyms(
32733275
end
32743276

32753277
search_synonyms_params.page += 1
3276-
break if res.nb_hits < search_synonyms_params.hits_per_page
3278+
break if res.hits.length < search_synonyms_params.hits_per_page
32773279
end
32783280

32793281
synonyms unless block_given?

0 commit comments

Comments
 (0)