Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blacklight params not getting passed to fetch_specific_range_limit method #255

Open
dolsysmith opened this issue Apr 15, 2024 · 0 comments

Comments

@dolsysmith
Copy link

dolsysmith commented Apr 15, 2024

Hi there,

Thank you for the Blacklight range limit gem!

We're implementing version 7.0.01 for our Hyrax repository (3.6). (Because of our Hyrax version and its dependencies, we're evidently not able to install anything higher.) The functionality works fine, but an error appears in the logs when executing a catalog search without range limits (or when removing a range facet):

NoMethodError (undefined method `[]' for false:FalseClass)

I've traced this error back to the fetch_specific_range_limit method in the RangeLimitBuilder module. As I understand it, this method gets added to the Blacklight processor chain specifically for the benefit of an AJAX request that is used to update the range facet. After some laborious debugging, I've determined that this method is -- in our case -- receiving an empty hash for the blacklight_params object, which should in fact contain the range limit parameters. And that object in turn seems to derive from Hyrax::SearchService.search_results, which yields a search builder configured using the search-service object's user_params attribute.

Because the params attribute seems to have the range parameters in the relevant case, I'm able to make the error go away by patching the Hyrax::SearchService.search_results method as follows:

if (respond_to?(:params) && user_params.empty?)
        builder = search_builder.with(params)
      else
        builder = search_builder.with(user_params)
      end

But that feels like a hack, so I'd much rather learn that we've configured something amiss, or else that this behavior has been fixed in a later version of the range limit gem.

We've included the RangeLimitBuilder module in our app's SearchBuilder module, and the catalog controller and routes are configured per the gem's specifications.

Any suggestions you can offer would be much appreciated.

Thank you!
Dolsy

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

No branches or pull requests

1 participant