Skip to content

Conversation

jcoyne
Copy link
Member

@jcoyne jcoyne commented May 29, 2025

No description provided.

Copy link
Contributor

@barmintor barmintor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rows logic here is weird. The logic appears to be:

  • Default the search_builders's rows config to 10 or the solr_params hash :rows value
  • force the solr_params rows value to be the seach_builder's rows

Should it just be solr_params[:rows] = rows || 10 ?

Copy link
Contributor

@seanaery seanaery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few of us took a quick look at this during the 6/18/25 Blacklight Community call and concluded we'd need more time to look closer to consider whether there are any legitimate conditions where rows might be nil (if not, this code is indeed unreachable and unnecessary).

As far as I can tell, rows can really only be nil if search_state.per_page returns nil. That will default to blacklight_config.default_per_page, which -- it turns out -- is actually nil out of the box.

There's also an existing spec for rows being nil here, and a Solr query would likely break if it ever had rows=nil (as opposed to just not specifying rows-- that'd default to 10 anyway).

So, my recommendation is that removing this line as @jcoyne proposed is good since it cleans up the logic, but then also make the change @barmintor proposed to the existing line beneath it so we set a default via || 10 and a potential nil won't cause any problems.

@jcoyne
Copy link
Member Author

jcoyne commented Aug 20, 2025

@seanaery the nil check already exists in https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/search_builder.rb#L106, so it would be redundant to add it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants