Bug 29191

Summary: Linking biblio headings to authorities doesn't work with subdivisions
Product: Koha Reporter: Alex Arnaud <alex.arnaud>
Component: Searching - ElasticsearchAssignee: Alex Arnaud <alex.arnaud>
Status: In Discussion --- QA Contact:
Severity: normal    
Priority: P5 - low CC: fridolin.somers, janet.mcgowan, phil
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18017
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28628
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28203
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 29191: Don't include subdivision names in heading search form with Elasticsearch

Description Alex Arnaud 2021-10-07 14:09:33 UTC
Linking biblio headings to authorities fails if there is subdivision(s) to search.

Test plan (Unimarc example):
  - AutoCreateAuthorities On
  - BiblioAddsAuthorities On
  - add a subject in a biblio: 606 $aArt $xHistory
  => new authority is created
  - reindex authorities if Zebra search engine
  - add same subject in an other biblio: 606 $aArt $xHistory
  => again, a new authority is created

Heading helper adds the subdiviion name in the search term. So the entire search query for mathing authorities is "Art generalsubdiv History"

I'm looking for a fix, but i need someone to explain me why we add something which is similar to metada in the search term.

This is done both for MARC21 and UNIMARC in
C4::Heading::UNIMARC::_get_search_heading
and
C4::Heading::MARC21::_get_search_heading
Comment 1 Alex Arnaud 2021-10-15 07:12:52 UTC
Created attachment 126306 [details] [review]
Bug 29191: Don't include subdivision names in heading search form with Elasticsearch
Comment 2 Alex Arnaud 2021-10-15 07:18:38 UTC
Changed the component to Searching - Elasticsearch since it works with Zebra with the correct configuration: authority-koha-indexdefs.xml index the subdivision names in match-heading.

I don't know how to make this configurable with Elasticsearch. So here is the quick fix that prevent adding subdivisions in search form for ES.

Alex
Comment 3 Fridolin Somers 2021-10-27 23:10:46 UTC
This is a bug not an enhancement right ?
Comment 4 Alex Arnaud 2021-10-28 06:59:30 UTC
(In reply to Fridolin Somers from comment #3)
> This is a bug not an enhancement right ?

yes. Changed to normal. Thx!
Comment 5 Phil Ringnalda 2023-03-04 18:01:11 UTC
By 2021 you should have had the fix for bug 24269 and thus should have had the subdivision metadata indexed in ES, shouldn't you?
Comment 6 Katrin Fischer 2023-06-24 19:56:26 UTC
(In reply to Phil Ringnalda from comment #5)
> By 2021 you should have had the fix for bug 24269 and thus should have had
> the subdivision metadata indexed in ES, shouldn't you?

it looks like the mappings weren't updated for UNIMARC. But maybe this would be the preferrable fix here?
Comment 7 Phil Ringnalda 2023-07-02 00:21:20 UTC
Mmm, mappings. The point of bug 24269 and bug 25273 was that you cannot do any better than Koha by mapping match-heading, because match-heading is only searched by the linker, and the linker will search for the search_form of the heading, so any mapping other than exactly that can only fail or return worse results. If you don't have any mapping at all for match-heading, then that's perfect, because Koha will build one by calling $heading->search_form and stuffing that into the index.

However, I know from having a service-provider-provided mapping file that had outdated mappings for match-heading that if you do have them, they will still be used, and will break things. That's probably where Alex was in 2021, with code that would have indexed headings as "Art generalsubdiv History" but with a match-heading mapping that prevented it from successfully doing so.