From ccbb9832e5fa4cafd8899ed120e0a571584aceaa Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Fri, 29 May 2026 13:39:41 -0500 Subject: [PATCH] Set the number of rows using the SearchBuilder This enables us to switch to an alternative repository backend --- app/controllers/concerns/blacklight/bookmarks.rb | 2 +- app/services/blacklight/search_service.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/concerns/blacklight/bookmarks.rb b/app/controllers/concerns/blacklight/bookmarks.rb index ae99c7e81..bc784be71 100644 --- a/app/controllers/concerns/blacklight/bookmarks.rb +++ b/app/controllers/concerns/blacklight/bookmarks.rb @@ -27,7 +27,7 @@ module Blacklight::Bookmarks def action_documents bookmarks = token_or_current_or_guest_user.bookmarks bookmark_ids = bookmarks.collect { |b| b.document_id.to_s } - search_service.fetch(bookmark_ids, rows: bookmark_ids.count) + search_service.fetch(bookmark_ids) end def action_success_redirect_path diff --git a/app/services/blacklight/search_service.rb b/app/services/blacklight/search_service.rb index 4c0a234de..0d0140139 100644 --- a/app/services/blacklight/search_service.rb +++ b/app/services/blacklight/search_service.rb @@ -152,11 +152,20 @@ def previous_and_next_document_params(*, **) def fetch_many(ids, extra_controller_params) extra_controller_params ||= {} + requested_rows = extra_controller_params.delete(:rows) + if requested_rows + Blacklight.deprecation.warn("Passing :rows to fetch_many is deprecated. Create an issue in blacklight if you see this warning. " \ + "Otherwise, :rows will be ignored in Blackight 10") + else + requested_rows = ids.count + end + query = search_builder .with(search_state) .where(blacklight_config.document_model.unique_key => ids) .merge(blacklight_config.fetch_many_document_params) .merge(extra_controller_params) + query.rows(requested_rows) # find_many was introduced in Blacklight 8.4. Before that, we used the # regular search method (possibly with a find-many specific `qt` parameter).