Bug 37446 - Home/holding library facets missing user friendly label
Summary: Home/holding library facets missing user friendly label
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low trivial
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
Depends on: 35138
Blocks:
  Show dependency treegraph
 
Reported: 2024-07-24 07:58 UTC by Lari Taskula
Modified: 2024-09-16 18:07 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch fixes the facet labels for holdingbranch and homebranch to ensure they say "Holding libraries" or "Home libraries" when Elasticsearch is enabled.
Version(s) released in:
Circulation function:


Attachments
Unfriendly facet label "homelibrary" (18.94 KB, image/png)
2024-07-24 07:59 UTC, Lari Taskula
Details
Bug 37446: Fix search facets for holding and home libraries (2.63 KB, patch)
2024-08-29 04:58 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 37446: Fix search facets for holding and home libraries (2.67 KB, patch)
2024-09-10 00:44 UTC, David Nind
Details | Diff | Splinter Review
Bug 37446: Fix search facets for holding and home libraries (2.73 KB, patch)
2024-09-16 18:07 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Taskula 2024-07-24 07:58:02 UTC
After upgrading to 24.05, the default Elasticsearch-Koha installation has facets for "Holding libraries" and "homelibrary" (see screenshot).

Bug 35138 introduced a search_field atomicupdate that changed holdingbranch and homebranch labels based on DisplayLibraryFacets system preference the following way:

"holdinglibrary" => "Holding libraries"
"homelibrary" => "Home libraries"

If DisplayLibraryFacets was set to "both", both labels would be updated. If not,  only one of them is changed.

DisplayLibraryFacets defaults to "holding" meaning a default Koha setup would only update "Holding libraries" and leave "homelibrary" as it is.

https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=165813&action=diff#a/installer/data/mysql/atomicupdate/bug_35138.pl_sec1

This creates an unfriendly facet label "homelibrary".
Comment 1 Lari Taskula 2024-07-24 07:59:06 UTC
Created attachment 169451 [details]
Unfriendly facet label "homelibrary"
Comment 2 Lari Taskula 2024-07-24 08:12:50 UTC
I'm trying to understand why the atomicupdate is updating either both of the labels or just one of them, based on DisplayLibraryFacets setting? What is the case where the other label should be left unchanged?
Comment 3 David Nind 2024-07-29 02:20:35 UTC
I don't know enough about what is happening (labels for the OPAC were fixed in bug 36750, but your screenshot looks like it is from the staff interface).

My understanding is that DisplayLibraryFacets is Zebra only now, so not sure why it would affect Elasticsearch, even if there was a database update for it.

In current main using koha-testing-docker and ES8, both of the labels display correctly for me.
Comment 4 Aleisha Amohia 2024-08-29 04:58:33 UTC
Created attachment 170855 [details] [review]
Bug 37446: Fix search facets for holding and home libraries

This bug ensures that the facet labels for holdingbranch and homebranch are updated, regardless of how the DisplayLibraryFacets system preference is set.

To test:

1. Check out an earlier version of Koha, for example `git checkout v23.11.08-1`
2. Spin up your development environment with elasticsearch, for example `ktd --es7 up`
3. Once it's ready, go to the staff interface and search for the DisplayLibraryFacets system preference in Koha administration. Set to 'holding library' if not already.
4. Do a catalogue search, notice the facets on the side. "Holding libraries" should show as normal. There should be no facet for home libraries.
5. In your terminal, check out 24.05.x, for example `git checkout v24.05.03`
6. Run database updates to upgrade Koha, for example `sudo koha-upgrade-schema kohadev`, and restart services `restart_all`
7. Repeat step 4. Notice the error in the facets "homelibrary"

8. Apply patch from Bug 37446
9. Repeat step 6
10. Repeat step 4. This time the facet should read "Home libraries"

Sponsored-by: Toi Ohomai Institute of Technology
Comment 5 David Nind 2024-09-10 00:44:43 UTC
Created attachment 171238 [details] [review]
Bug 37446: Fix search facets for holding and home libraries

This bug ensures that the facet labels for holdingbranch and homebranch are updated, regardless of how the DisplayLibraryFacets system preference is set.

To test:

1. Check out an earlier version of Koha, for example `git checkout v23.11.08-1`
2. Spin up your development environment with elasticsearch, for example `ktd --es7 up`
3. Once it's ready, go to the staff interface and search for the DisplayLibraryFacets system preference in Koha administration. Set to 'holding library' if not already.
4. Do a catalogue search, notice the facets on the side. "Holding libraries" should show as normal. There should be no facet for home libraries.
5. In your terminal, check out 24.05.x, for example `git checkout v24.05.03`
6. Run database updates to upgrade Koha, for example `sudo koha-upgrade-schema kohadev`, and restart services `restart_all`
7. Repeat step 4. Notice the error in the facets "homelibrary"

8. Apply patch from Bug 37446
9. Repeat step 6
10. Repeat step 4. This time the facet should read "Home libraries"

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: David Nind <david@davidnind.com>
Comment 6 Jonathan Druart 2024-09-10 07:48:50 UTC
Yes there is something wrong. The label should be adjusted for both, but we needed to take into account DisplayLibraryFacets to set facet_order to NUL if we didn't want to display it.

Is that correct?
Comment 7 Nick Clemens (kidclamp) 2024-09-16 18:04:25 UTC
(In reply to Jonathan Druart from comment #6)
> Yes there is something wrong. The label should be adjusted for both, but we
> needed to take into account DisplayLibraryFacets to set facet_order to NUL
> if we didn't want to display it.
> 
> Is that correct?

The previous update doesn't seem to have touched facet_order:
vim installer/data/mysql/db_revs/231200036.pl

If I understand, the changes in 35138 moved the control from the syspref to the mappings - but existing mapping weren't touched, so libraries will now ignore the syspref and display noth until mappings are altered. 

In either case, I think the only place the labels are used are int he facets - so updating the labels to be correct no matter what shows does seem the right thing to do
Comment 8 Nick Clemens (kidclamp) 2024-09-16 18:07:38 UTC
Created attachment 171576 [details] [review]
Bug 37446: Fix search facets for holding and home libraries

This bug ensures that the facet labels for holdingbranch and homebranch are updated, regardless of how the DisplayLibraryFacets system preference is set.

To test:

1. Check out an earlier version of Koha, for example `git checkout v23.11.08-1`
2. Spin up your development environment with elasticsearch, for example `ktd --es7 up`
3. Once it's ready, go to the staff interface and search for the DisplayLibraryFacets system preference in Koha administration. Set to 'holding library' if not already.
4. Do a catalogue search, notice the facets on the side. "Holding libraries" should show as normal. There should be no facet for home libraries.
5. In your terminal, check out 24.05.x, for example `git checkout v24.05.03`
6. Run database updates to upgrade Koha, for example `sudo koha-upgrade-schema kohadev`, and restart services `restart_all`
7. Repeat step 4. Notice the error in the facets "homelibrary"

8. Apply patch from Bug 37446
9. Repeat step 6
10. Repeat step 4. This time the facet should read "Home libraries"

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>