Bug 37057 - OPACShowUnusedAuthorities displays unused authorities regardless
Summary: OPACShowUnusedAuthorities displays unused authorities regardless
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: 23.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
Keywords: regression
Depends on: 12478
  Show dependency treegraph
Reported: 2024-06-07 17:44 UTC by Esther Melander
Modified: 2024-06-11 12:39 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:

Bug 37057: Restore filtering of unused authorities (2.04 KB, patch)
2024-06-11 12:37 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 Esther Melander 2024-06-07 17:44:38 UTC
To replicate:

1. Create a topic term authority "Example"
2. Duplicate that authority so there are two
3. Find a record and add the topical term "Example"
4. Link the topical term in the record to one of the two Example authorities.
5. Set OPACShowUnusedAuthorities to show.
6. Ensure OpacAuthorities is set to Allow.
7. Search Authorities in the OPAC for "Example"

A list should be returned with Example listed twice. One of the authorities should display it is linked to a record and one should be "0" for no link.

8. Change OPACShowUnusedAuthorities to don't show
9. Refresh the page and repeat the authority search for "Example"

See that the search results are identical. The Example result with no linked records still displays. I would have expected it to not display, unless there is some other preference or option that needs to be set.
Comment 1 Phil Ringnalda 2024-06-10 17:25:54 UTC
That would be from bug 12478 in https://git.koha-community.org/Koha-community/Koha/commit/0002bbc72a42b4c4223e20c66ef032c20f48ba19 - apparently at one point, Elasticsearch hadn't yet implemented authority usage counts, so they just commented out the whole OPACShowUnusedAuthorities feature for ES and Zebra, and left it that way.
Comment 2 Nick Clemens (kidclamp) 2024-06-11 12:37:29 UTC
Created attachment 167629 [details] [review]
Bug 37057: Restore filtering of unused authorities

Bug 12478 commented this code out, however, we do return the 'used' parameter in ES authority searches. While
we should implement the feature for both ES and Zebra as an index, we can restore this behaviour here.

To test:
1 - Search authorities on OPAC with SearchEngine syspref set to both Elasticsearch and Zebra
    I just searched for 'a'
2 - Confirm results with no usage are included
3 - Test with both values of OPACShowUnusedAuthorities
4 - Apply patch
5 - Repeat searches with both engines and syspref settings
6 - Confirm unused authorities not shown in either engine when syspref is "Don't show"
7 - Conifrm unused authorities shown in both engines when syspref is "Show"