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

Enable AND/OR search for normal search boxes around Scholars Archive #2639

Open
straleyb opened this issue Jul 16, 2024 · 0 comments
Open

Enable AND/OR search for normal search boxes around Scholars Archive #2639

straleyb opened this issue Jul 16, 2024 · 0 comments

Comments

@straleyb
Copy link
Contributor

Descriptive summary

The ability to do "advanced search" on normal search boxes had to be disabled to make adding sub-collections to collections work. This was done by removing one of the filters from the SearchBuilder model and CatalogSearchBuilder. This filter is one of the configurations found in the Blacklight Advanced Search configuration steps. We would need to add add_advanced_parse_q_to_solr back into the default processor chain. This would enable the ability to search using AND/OR in normal search boxes to help refine searches. I.E My_Title AND Some_Creator. This would be useful in the system to help disambiguate certain searches depending on how much they overlap and help people find things easier.

The error spawns from some piece of configuration not taking. In the code in Blacklight Advanced Search, it tries to find the default search field and use that to do the search. Then it checks to see if advanced search had been enabled on it. If so it does the advanced parse q in solr to refine your search. If not it just skips. Currently its not finding that default. So when it checks that advanced search has been able it has a nil value and cant make the method calls it wants to.

https://github.com/projectblacklight/blacklight_advanced_search/blob/f3840353833cd3e8fb758485d87a3a875c052f6e/lib/blacklight_advanced_search/advanced_search_builder.rb#L54-L58

This is where the failure is occurring. When it calls blacklight_config.search_fields[blacklight_params[:search_field]] || blacklight_config.default_search_field both those return nil.

When it checks field_def[:advanced_parse] == false field def is a nil value so checking advanced_parse it throws a undefined method [] for nil.

I believe we would have to configure the default search field or get search fields[blacklight_params[:search_field]] to return the proper values. I was trying to get this configured in the blacklight configuration but it didn't seem like it was working. So more exploration about why those are returning nil is required.

Expected behavior

Doing searches with AND/OR in normal search boxes around Scholars Archive works and refines searches.

Actual behavior

AND/OR do not help refine searches

Related work

#2629
#2636

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

No branches or pull requests

1 participant