From d06fe56d4acb2dbea3683302fbe9385805327714 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Thu, 31 Oct 2024 16:25:28 +0000 Subject: [PATCH] fix(clients): update browse iterator (generated) https://github.com/algolia/api-clients-automation/pull/4058 Co-authored-by: algolia-bot Co-authored-by: Thomas Raffray --- lib/algolia/api/search_client.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/algolia/api/search_client.rb b/lib/algolia/api/search_client.rb index c4dabb21..e5c1a7e6 100644 --- a/lib/algolia/api/search_client.rb +++ b/lib/algolia/api/search_client.rb @@ -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) @@ -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? @@ -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?