[Koha-bugs] [Bug 17885] Koha::SearchEngine::Elasticsearch-> reset_elasticsearch_mappings throws DBD::mysql Duplicate entry exceptions

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jan 12 15:36:24 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #3 from Olli-Antti Kivilahti <olli-antti.kivilahti at jns.fi> ---
Hi.

You can recreate the problem with this:

perl -e 'use Koha::SearchEngine::Elasticsearch;
Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings'



Your solution looks very simple :)
Unfortunately there is a bunch of business logic clumped together in the
/admin/searchengine/elasticsearch/mappings.pl
And I don't think business logic belongs to a controller module. Simply because
that functionality is needed when writing tests. When writing tests it is
better to call that one subroutine reset_elasticsearch_mappings instead of the
bunch of code in mappings.pl

If a subroutine says reset_elasticsearch_mappings(), I expect it to reset the
elasticsearch mappings without errors.

A simple solution would be to move:
        Koha::SearchMarcMaps->search->delete;
inside 
        Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings;

which might be a better one than the DBIC-monster I created.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list