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

Spotlight defaults are overwritten by blacklight #2928

Open
jcoyne opened this issue Feb 28, 2023 · 0 comments
Open

Spotlight defaults are overwritten by blacklight #2928

jcoyne opened this issue Feb 28, 2023 · 0 comments

Comments

@jcoyne
Copy link
Member

jcoyne commented Feb 28, 2023

I'm seeing some cases in a development server (puma) where these values are not "remembered" by the code that needs them.

https://github.com/projectblacklight/spotlight/blob/main/lib/spotlight/engine.rb#L251-L262

This is manifesting as:

Blacklight::Exceptions::InvalidRequest in Spotlight::CatalogController#admin
RSolr::Error::Http - 400 Bad Request
Error: Can't determine a Sort Order (asc or desc) in sort spec ' desc', pos=5

because blacklight_config.index.timestamp_field is nil when we try to use it here:

solr_params = { sort: "#{blacklight_config.index.timestamp_field} desc" }

When I set a breakpoint in the Engine and one where the value is used it appears to be a different object:

# In the Engine
(ruby) Blacklight::Configuration.default_values[:index].object_id
85700
# In the SearchBuilder
Blacklight::Configuration.default_values[:index].object_id
156400
Blacklight::Configuration.default_values[:index].thumbnail_field
nil

This happens because the Blacklight initializer runs later and overwrites the configs set by Spotlight: https://github.com/projectblacklight/blacklight/blob/9e517006cf8373af1d623c2664276038a2258b2e/lib/blacklight/engine.rb#L9-L11

This was introduced in projectblacklight/blacklight#2826

@jcoyne jcoyne changed the title Blacklight defaults are not being set Spotlight defaults are overwritten by blacklight Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant