Skip to content

Commit

Permalink
fix(clients): update browse iterator (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4058

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Thomas Raffray <[email protected]>
  • Loading branch information
algolia-bot and Fluf22 committed Oct 31, 2024
1 parent 601a9ce commit d06fe56
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/algolia/api/search_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3201,6 +3201,8 @@ def wait_for_api_key(
# @param request_options [Hash] the requestOptions to send along with the query, they will be forwarded to the `browse` method.
# @param block [Proc] the block to execute on each object of the index.
def browse_objects(index_name, browse_params = Search::BrowseParamsObject.new, request_options = {}, &block)
browse_params[:hits_per_page] = browse_params[:hits_per_page] || 1000

hits = []
loop do
res = browse(index_name, browse_params, request_options)
Expand Down Expand Up @@ -3243,7 +3245,7 @@ def browse_rules(
end

search_rules_params.page += 1
break if res.nb_hits < search_rules_params.hits_per_page
break if res.hits.length < search_rules_params.hits_per_page
end

rules unless block_given?
Expand Down Expand Up @@ -3273,7 +3275,7 @@ def browse_synonyms(
end

search_synonyms_params.page += 1
break if res.nb_hits < search_synonyms_params.hits_per_page
break if res.hits.length < search_synonyms_params.hits_per_page
end

synonyms unless block_given?
Expand Down

0 comments on commit d06fe56

Please sign in to comment.