Bug 40994

Summary: Field 651 subfields other than "a" present in Topics facet
Product: Koha Reporter: Lari Taskula <lari.taskula>
Component: Searching - ElasticsearchAssignee: Lari Taskula <lari.taskula>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 40994: Index 651a instead of 651
Bug 40994: Remove 651 from facets
Bug 40994: Add 651a to facets

Description Lari Taskula 2025-10-10 12:45:37 UTC
To reproduce:

1. Start creating a new record
2. Populate the following field:

651:
_a Suomi
_2 yso/fin
_0 http://www.yso.fi/onto/yso/p94426

3. Save the record (and ensure the new record gets indexed)
4. On either OPAC or staff client, search for all records
5. Observe "Suomi", "yso/fin", "http://www.yso.fi/onto/yso/p94426" under "Topics" facet

How it should be:

4. On either OPAC or staff client, search for all records
5. Observe "Suomi" under "Topics" facet
Comment 1 Lari Taskula 2025-10-10 12:48:47 UTC Comment hidden (obsolete)
Comment 2 Lari Taskula 2025-10-10 13:00:13 UTC
Created attachment 187732 [details] [review]
Bug 40994: Remove 651 from facets

1. Start creating a new record
2. Populate the following field:

651:
_a Suomi
_2 yso/fin
_0 http://www.yso.fi/onto/yso/p94426

3. Save the record (and ensure the new record gets indexed)
4. On either OPAC or staff client, search for su:yso/fin
5. Observe your record in the results
6. Observe there are no "Suomi", "yso/fin", or the link under "Topics" facet
Comment 3 Lari Taskula 2025-10-10 13:00:14 UTC
Created attachment 187733 [details] [review]
Bug 40994: Add 651a to facets

To test:

1. Start creating a new record
2. Populate the following field:

651:
_a Suomi
_2 yso/fin
_0 http://www.yso.fi/onto/yso/p94426

3. Save the record (and ensure the new record gets indexed)
4. On either OPAC or staff client, search for all records
5. Observe "Suomi" under "Topics" facet
Comment 4 Lari Taskula 2025-10-10 13:03:51 UTC
I'm not sure why the entire 651 field is in the subject index in the first place. The above patches maintain the entire field in the search index as it is, but change 651a to be the only subfield to be faceted under "Topics".