Bug 22879

Summary: Cannot reindex elastic if missing metadata
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Searching - ElasticsearchAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P5 - low    
Version: unspecified   
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:
Attachments: Bug 22879: Add a test-like

Description Jonathan Druart 2019-05-09 15:07:13 UTC
kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ perl -MCarp::Always misc/search_tools/rebuild_elastic_search.pl -d -a -b
No record passed at /home/vagrant/kohaclone/Koha/MetadataRecord.pm line 82.
        Koha::MetadataRecord::new("Koha::BiblioUtils", HASH(0x55ee0f6a58f8)) called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 62
        Koha::BiblioUtils::new("Koha::BiblioUtils", undef, 647) called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 128
        eval {...} called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 127
        Koha::BiblioUtils::__ANON__() called at /home/vagrant/kohaclone/Koha/MetadataIterator.pm line 71
        Koha::MetadataIterator::next(Koha::MetadataIterator=HASH(0x55ee0c8d4278)) called at misc/search_tools/rebuild_elastic_search.pl line 137
        main::__ANON__() called at misc/search_tools/rebuild_elastic_search.pl line 182
        main::do_reindex(CODE(0x55ee0c8cc380), "biblios") called at /home/vagrant/kohaclone/Koha/MetadataRecord.pm line 82.
        Koha::MetadataRecord::new("Koha::BiblioUtils", HASH(0x55ee0f6a58f8)) called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 62
        Koha::BiblioUtils::new("Koha::BiblioUtils", undef, 647) called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 128
        eval {...} called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 127
        Koha::BiblioUtils::__ANON__() called at /home/vagrant/kohaclone/Koha/MetadataIterator.pm line 71
        Koha::MetadataIterator::next(Koha::MetadataIterator=HASH(0x55ee0c8d4278)) called at misc/search_tools/rebuild_elastic_search.pl line 137
        main::__ANON__() called at misc/search_tools/rebuild_elastic_search.pl line 182
        main::do_reindex(CODE(0x55ee0c8cc380), "biblios") called at misc/search_tools/rebuild_elastic_search.pl line 140
Something went wrong reading record for biblio Koha::Schema::Result::Biblio=HASH(0x55ee0f686228)->biblionumber: Can't bless non-reference value at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 70.
        Koha::BiblioUtils::new("Koha::BiblioUtils", undef, 647) called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 128
        eval {...} called at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 127
        Koha::BiblioUtils::__ANON__() called at /home/vagrant/kohaclone/Koha/MetadataIterator.pm line 71
        Koha::MetadataIterator::next(Koha::MetadataIterator=HASH(0x55ee0c8d4278)) called at misc/search_tools/rebuild_elastic_search.pl line 137
        main::__ANON__() called at misc/search_tools/rebuild_elastic_search.pl line 182
        main::do_reindex(CODE(0x55ee0c8cc380), "biblios") called
 at /home/vagrant/kohaclone/Koha/BiblioUtils.pm line 131.
        Koha::BiblioUtils::__ANON__() called at /home/vagrant/kohaclone/Koha/MetadataIterator.pm line 71
        Koha::MetadataIterator::next(Koha::MetadataIterator=HASH(0x55ee0c8d4278)) called at misc/search_tools/rebuild_elastic_search.pl line 137
        main::__ANON__() called at misc/search_tools/rebuild_elastic_search.pl line 182
        main::do_reindex(CODE(0x55ee0c8cc380), "biblios") called at misc/search_tools/rebuild_elastic_search.pl line 140
Comment 1 Jonathan Druart 2019-05-09 15:40:44 UTC
Lowering severity as I do not recreate on a fresh install.

It seems that the biblio 647 was a leftover from a test, and did not contain the biblioitems or biblio_metadata
Comment 2 Jonathan Druart 2019-05-09 15:45:55 UTC
Created attachment 89515 [details] [review]
Bug 22879: Add a test-like
Comment 3 Katrin Fischer 2019-05-11 23:15:19 UTC
Still work in progress?
Comment 4 Jonathan Druart 2019-05-11 23:45:47 UTC
(In reply to Katrin Fischer from comment #3)
> Still work in progress?

Nothing more from me.
Comment 5 Katrin Fischer 2019-05-12 05:28:53 UTC
Should this be closed then?
Comment 6 Jonathan Druart 2019-05-12 16:03:16 UTC
(In reply to Katrin Fischer from comment #5)
> Should this be closed then?

I added a test to highlight the problem, it is an issue that need to be fixed I think.