When GuessAuthTypeCode encounters a record containing tag 147, it returns 'NAME_EVENT'. But in the default Koha installation, 'NAME_EVENT' is not registered in auth_types: select * from auth_types where authtypecode = 'NAME_EVENT'; Empty set (0.000 sec) This causes a bug in Koha/SearchEngine/Elasticsearch.pm:362, because $field is undefined and then passed on to C4::Heading->new_from_field, which dies: Can't call method "tag" on an undefined value at /usr/share/koha/lib/C4/Heading.pm line 71 A simple fix (will be provided soon) is to just ignore and report such cases (as done a few lines further down in Koha/SearchEngine/Elasticsearch.pm, when there is no $authtypecode.
Created attachment 134639 [details] [review] Skip unknown authtypes instead of dying Fixes the bug...
Test Plan: * Confirm that you do not have an authtype 'NAME_EVENT' (either in the DB or /cgi-bin/koha/admin/authtypes.pl * Enable ElasticSearch * Create or edit an authoritiy record of type 'MEETI_NAME', make sure that 111 is empty, and 147 has some content (you might even need to fiddle with the frameworks to show the 147 form in the editor) * Note the ID of the auth record * Run the ES indexer, limited on the auth id: bin/search_tools/rebuild_elasticsearch.pl -a -v -ai $YOUR_AUTH_ID * The script will die with a message like: [2374] Committing final records... Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202. Use of uninitialized value $tag in regexp compilation at /usr/share/perl5/MARC/Record.pm line 206. Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 207. Can't call method "tag" on an undefined value at /usr/share/koha/lib/C4/Heading.pm line 71. Now apply the patch. * Run ES indexer again * It should now report something like [2374] Committing final records... Cannot handle authority type NAME_EVENT for record: 1046314. It seems like this authority type is not defined in your instance at /usr/share/koha/lib/Koha/SearchEngine/Elasticsearch.pm line 566. [2374] Total 1 records indexed Sponsored-by: Steiermärkische Landesbibliothek
Test plan can't go in that order, because GuessAuthTypeCode runs and we throw when you save the authority record. So it has to be * Leave SearchEngine set to Zebra * Edit MEETI_NAME framework, uncheck Mandatory for tag 111 * Create authority with 147 and no 111 * Switch SearchEngine to ElasticSearch, reindex Seems like a bug that we include 147 in every authtype framework, since having two 1xx headings in an authority record is both invalid and not going to work, and you have to go to a lot of trouble to make the one that should be mandatory for that authtype not mandatory to have the 147 even pretend to do something. But since 147 and 162 exist, but are too obscure to be worth shipping an authtype framework for them, this seems like a reasonable solution if people do the wrong thing trying to use them. The patch doesn't work, though, since some stray whitespace crept into "->as _string."
Should this be Needs Signoff?
No, since "The patch doesn't work, though, since some stray whitespace crept into "->as _string.""