Skip to content

Commit

Permalink
Merge pull request #4625 from pulibrary/i4568-pagination-bookmarks
Browse files Browse the repository at this point in the history
[#4568] Don't apply excessive paging considerations to the bookmarks page
  • Loading branch information
christinach authored Dec 9, 2024
2 parents bae2f8c + fe9d48d commit d09d3a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def excessive_paging_error(_solr_parameters)
def excessive_paging?
page = blacklight_params[:page].to_i || 0
return false if page <= 1
return false if (search_parameters? || advanced_search?) && page < 1000
return false if (search_parameters? || advanced_search? || bookmarks_page?) && page < 1000
true
end

Expand Down Expand Up @@ -153,4 +153,8 @@ def add_edismax(advanced_fields:)
blacklight_config.search_fields[field]['clause_params'] = { edismax: }
end
end

def bookmarks_page?
blacklight_params[:controller] == 'bookmarks'
end
end
6 changes: 6 additions & 0 deletions spec/models/search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
expect(search_builder.excessive_paging?).to be false
end

it 'allows paging for bookmarks controller' do
search_builder.blacklight_params[:page] = reasonable
search_builder.blacklight_params[:controller] = 'bookmarks'
expect(search_builder.excessive_paging?).to be false
end

it 'handles query ending with empty parenthesis' do
search_builder.blacklight_params[:q] = 'hello world ()'
search_builder.parslet_trick({})
Expand Down

0 comments on commit d09d3a7

Please sign in to comment.