Bug 15728

Summary: Hide component parts from search result
Product: Koha Reporter: Lari Taskula <lari.taskula>
Component: SearchingAssignee: Galen Charlton <gmcharlt>
Status: BLOCKED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38215    
Bug Blocks:    
Attachments: Bug 15728: Add system preference ShowComponentRecordsFacet
Bug 15728: Elasticsearch - Support component records limit
Bug 15728: Zebra - Support component records limit
Bug 15728: Add component records facet to staff client
Bug 15728: Add component records facet to OPAC
Bug 15728: Add component records facet to staff client
Bug 15728: Add component records facet to OPAC

Description Lari Taskula 2016-02-03 13:17:17 UTC
Add an option to hide component parts from search results. When searching for a song, we may want to see album results only (albums where the song appears). This option would help the process of seeing if a song is on an album that is available.
Comment 1 Katrin Fischer 2016-02-08 20:05:28 UTC
Hi Lari, can you explain how the component parts are cataloged? What would be the criteria for hiding? Just curious - we have a lot of links between titles in our catalogs.
Comment 2 Lari Taskula 2024-10-19 13:35:16 UTC
Created attachment 173001 [details] [review]
Bug 15728: Add system preference ShowComponentRecordsFacet

This controls the visibility of component records facet both in OPAC
and staff interface.
Comment 3 Lari Taskula 2024-10-19 13:35:18 UTC
Created attachment 173002 [details] [review]
Bug 15728: Elasticsearch - Support component records limit

To test:

Apply all patches from this Bug.
Execute steps 5-15 both in staff client and OPAC

1. prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
2. Set system preferences
 SearchEngine = Elasticsearch
 ShowComponentRecordsFacet = both staff interface and OPAC
3. Create a new record (leader/7 should NOT be "a" nor "b")
4. Create two new component records (leader/7 should be "a" or "b")
5. Search catalog with *
6. Observe facets containing category "Component records"
7. Note down total number of search results (referred as ALL)
8. From facets, click "Limit to component records"
9. Note down total number of component record results (referred as COMP)
10. From search results, observe your newly created component records
11. From facets under Component records, click "Show all records"
12. Observe number of search results equal to ALL
13. From facets, click "Exclude component records"
14. Observe total number of search results being ALL-COMP
15. Observe your newly created component records not part of results
Comment 4 Lari Taskula 2024-10-19 13:35:20 UTC
Created attachment 173003 [details] [review]
Bug 15728: Zebra - Support component records limit

To test:

Apply all patches from this Bug
Execute steps 5-15 both in staff client and OPAC

1. prove t/db_dependent/Search.t
2. Set system preferences
 SearchEngine = Zebra
 ShowComponentRecordsFacet = both staff interface and OPAC
3. Create a new record (leader/7 should NOT be "a" nor "b")
4. Create two new component records (leader/7 should be "a" or "b")
5. Search catalog with allrecords,AlwaysMatches=""
6. Observe facets containing category "Component records"
7. Note down total number of search results (referred as ALL)
8. From facets, click "Limit to component records"
9. Note down total number of component record results (referred as COMP)
10. From search results, observe your newly created component records
11. From facets under Component records, click "Show all records"
12. Observe number of search results equal to ALL
13. From facets, click "Exclude component records"
14. Observe total number of search results being ALL-COMP
15. Observe your newly created component records not part of results
Comment 5 Lari Taskula 2024-10-19 13:35:22 UTC
Created attachment 173004 [details] [review]
Bug 15728: Add component records facet to staff client

Test plan provided in "Support component records limit" commits.
Comment 6 Lari Taskula 2024-10-19 13:35:24 UTC
Created attachment 173005 [details] [review]
Bug 15728: Add component records facet to OPAC

Test plan provided in "Support component records limit" commits.
Comment 7 Lari Taskula 2024-10-19 14:21:25 UTC
(In reply to Katrin Fischer from comment #1)
> Hi Lari, can you explain how the component parts are cataloged? What would
> be the criteria for hiding? Just curious - we have a lot of links between
> titles in our catalogs.

Hey Katrin, sorry for the late answer.

Here component parts have been an issue not only but mainly to music catalogers. A typical music use case for us is an album (host record) and tracks on the album (components). We use component record's 773$w for linking the host (001).

Our catalogers have been wanting to filter component parts (or the opposite only display component parts) from search results.

I attached patches that add a new facet "Component records", of which visibility is controlled by a system preference "ComponentRecordsFacet" (nowhere,opac,staff,both). 
Defaults to "nowhere" so that no visible changes will be present unless the library enables this feature. The facet contains two options:
- Exclude component records
- Limit to comonent records

Excluding component records filters out all records that have Bib-level(ldr/7):a or b. Limiting to component records is the opposite, only resulting records that have Bib-level:a or b. That is the only criteria I've proposed in these patches - patches do not care about 773$w or anything else.

At Finnish public libraries, we've had something similar in production for many years. One of our special library clients, specializing in music, was hoping for this feature in upstream Koha.

Note that for Zebra users this is partially blocked by Bug 38215 as these patches introduce the same bug described in Bug 38215. For Zebra, searching and limiting works but clearing the limit doesn't work so nicely. Elasticsearch works great.
Comment 8 Lari Taskula 2024-10-19 15:55:52 UTC
Created attachment 173007 [details] [review]
Bug 15728: Add component records facet to staff client

Test plan provided in "Support component records limit" commits.
Comment 9 Lari Taskula 2024-10-19 15:55:54 UTC
Created attachment 173008 [details] [review]
Bug 15728: Add component records facet to OPAC

Test plan provided in "Support component records limit" commits.