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

Toggle display location in search facets #88

Conversation

Chloe070196
Copy link

@Chloe070196 Chloe070196 commented Jul 19, 2024

Description:

The request was to add a setting in Primary Configuration > Locations > Searching to hide the branch from the search facets and the advanced search.

This patch implements the first part of that request by adding a 'Show This Branch In Search Facet' checkbox under Searching > Search Facets. This removes the need for additional CSS or JS scripts to hide the ability to search by a specific branch, without affecting the search results themselves (the relevant stock for a branch with a hidden visibility in the search facet will still be found and rendered).

Test plan:

  • implement the patch
  • login in to Aspen as an admin
  • go to Catalog / Grouped Works > 'Grouped Work Facets' in Aspen Administration
  • edit 'public'
  • add a new facet: Facet: Branch, Display Name: Library, Plural Display Name: Libraries, and save
  • run a search
  • open the 'Available At' search facet and the 'Libraries' search facet
  • take note of the branches listed as search by options
  • also take notes of the search results, so that you can compare them to a later search
  • navigate to Aspen Discovery Administration > Primary Configuration > Locations(Branches)
  • from the list, select one branch that you noted was display in the facet
  • click on edit
  • on this branch's settings page, navigate to 'Searching' > Search Facets
  • notice that 'Show This Branch In Search Facet' is now an option and is enabled (by default)
  • uncheck 'Show This Branch In Search Facet' and save your changes
  • run an identical search to the earlier one
  • open the 'Available At' search facet and the 'Libraries' search facet, and notice that the branch of which you have disable the display in search facet setting does not appear anymore
  • also notice that the search results themselves are unaffected (copies found at the branch hidden from the facets still are found and displayed)

Note: it can also be toggled back on, which can be tested following a similar procedure

Get the list of branches related to the main branch, and swap the
original keys (integers) for the names of the branches, so that the
branches can easily be accessed in the list later on by doing
$branchlist[$branchName].
This ensures that, when a user runs a search, the list of branches
displaying under 'Available At' in the 'Narrow Your Results' facet list
is filtered, and only includes branches for which the 'Show This Branch
In Search Facet' setting has not been disabled by an admin.
With this search facet location options filter occuring at runtime, the
'Updating this setting causes a nightly reindex' message should not be
displayed.
@Chloe070196 Chloe070196 force-pushed the toggle_display_location_in_search_facets branch from 41b746c to 909f2c5 Compare July 26, 2024 13:12
The 'branch' facet, which can be added to the list of search facets to
be displayed, also contains locations (library branches) and therefore
must also be affected by the filter, which is what this commit
implements.
@AlexanderBlanchardAC AlexanderBlanchardAC changed the base branch from toggle_display_location_in_search_facets to toggle_display_location_in_search_facets_two July 26, 2024 15:31
@AlexanderBlanchardAC AlexanderBlanchardAC changed the base branch from toggle_display_location_in_search_facets_two to toggle_display_location_in_search_facets July 26, 2024 15:33
@AlexanderBlanchardAC AlexanderBlanchardAC changed the base branch from toggle_display_location_in_search_facets to toggle_display_location_in_search_facets_two July 26, 2024 15:37
@AlexanderBlanchardAC AlexanderBlanchardAC changed the base branch from toggle_display_location_in_search_facets_two to toggle_display_location_in_search_facets July 26, 2024 15:38
@AlexanderBlanchardAC
Copy link

Code looks good and removes / adds libraries from facets perfectly in testing.

@Chloe070196 Chloe070196 merged commit 6e8e4bd into PTFS-Europe:toggle_display_location_in_search_facets Jul 26, 2024
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.

2 participants