Main Koha release repository https://koha-community.org
Find a file
Joonas Kylmälä 9c0dc6efff
Bug 17885: Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings throws DBD::mysql Duplicate entry exceptions
When executing
Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings()
against populated search engine mappings tables, one gets this
exception:

DBD::mysql::st execute failed: Duplicate entry '388-73' for key
'PRIMARY' [for Statement \"INSERT INTO `search_marc_to_field` ( `facet`,
`search_field_id`, `search_marc_map_id`, `sort`, `suggestible`) VALUES (
?, ?, ?, ?, ? )\" with ParamValues: 0='', 1='73', 2='388', 3=undef,
4=''] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line
1834.\nDBIx::Class::Storage::DBI::_dbh_execute(): Duplicate entry
'388-73' for key 'PRIMARY' at /home/koha/Koha/Koha/SearchField.pm line
38"

This patch fixes this, by first deleting all entries, then adding the
default ones.

If a subroutine says reset_elasticsearch_mappings(), I expect it to
reset the elasticsearch mappings without errors.  When writing tests it
is better to call that one subroutine reset_elasticsearch_mappings
instead of the bunch of code in
admin/searchengine/elasticsearch/mappings.pl?op=reset_confirmed
Also this promotes code reuse.

TEST PLAN:

a. perl -e 'use Koha::SearchEngine::Elasticsearch; Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings'
b. Run misc/devel/populate_db.pl on an already populated DB and you eventually
face this problem.

After this patch, step a. works.

This patch is adapted from the original patch made by Olli-Antti
Kivilahti <olli-antti.kivilahti@jns.fi>.

Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-10 16:20:29 +00:00
acqui Bug 24277: Fix date received editing when receiving an order 2020-01-08 14:26:57 +00:00
admin Bug 17885: Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings throws DBD::mysql Duplicate entry exceptions 2020-01-10 16:20:29 +00:00
api/v1 Bug 18731: OpenAPI definitions 2020-01-09 16:25:57 +00:00
authorities Bug 19994: Used Modern::Perl in Authorities perl scripts 2019-01-28 14:58:23 +00:00
basket Bug 11529: Add templates for biblio title display. Unify display. 2019-08-05 15:03:19 +01:00
C4 Bug 23934: Item level holds not checked for LocalHoldsPriority in Holds Queue 2020-01-10 16:19:40 +00:00
catalogue Bug 23970: Make search with "Publication date" field work at any position 2019-12-10 16:13:39 +00:00
cataloguing Bug 9156: (follow-up) Simplify code 2020-01-10 16:14:20 +00:00
circ Bug 24106: In returns.pl, don't search for item if no barcode is provided 2019-12-13 14:03:52 +00:00
clubs Bug 18632: Remove 'CGI::param called in list context' warnings 2017-05-28 22:25:22 -04:00
course_reserves Bug 21003: Removed warning and changed wording on add_items-step2.tt 2019-03-23 09:51:36 +00:00
debian Bug 19465: Document koha-create --elasticsearch-server option switch 2019-12-23 11:29:58 +00:00
docs Koha 19.12 - Dobbie is a free elf... 2019-12-02 17:13:15 +00:00
errors Bug 23329: Move error page to its own subroutine 2019-11-27 11:30:19 +00:00
etc Bug 15142: (follow-up) Remove facet configuration from .xsl file 2020-01-10 16:16:49 +00:00
ill Bug 21460: (follow-up) Fix bugs found in QA 2019-04-25 10:46:56 +00:00
installer Bug 24206: DBRev 19.12.00.008 2020-01-10 16:12:38 +00:00
Koha Bug 17885: Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings throws DBD::mysql Duplicate entry exceptions 2020-01-10 16:20:29 +00:00
koha-tmpl Bug 9156: Clarify order in the syspref 2020-01-10 16:14:36 +00:00
labels Bug 21206: Replace C4::Items::GetItem 2019-02-26 13:24:07 +00:00
members Bug 23442: Add refund option to patron account page 2020-01-10 08:41:18 +00:00
misc Bug 23377: (QA follow-up) Use OVERRIDE_SYSPREF 2020-01-10 10:56:41 +00:00
offline_circ Bug 22600: Add 'interface' to accountlines 2019-04-10 19:43:11 +00:00
opac Bug 24327: Redirect to the login form if AnonSuggestion misconfigured 2020-01-08 14:13:46 +00:00
OpenILS Bug 9239 QA follow-up: remove stray debug code 2013-03-16 21:32:34 -04:00
patron_lists Bug 19524: Use existing logged_in_user variable 2018-07-18 16:49:30 +00:00
patroncards Bug 21719: Fix typos 2018-11-08 02:18:46 +00:00
plugins Bug 21073: (QA follow-up) Avoid unnecessary unless/else construct 2019-06-18 17:30:44 +01:00
reports Bug 24177: (QA follow-up) Fix warning 2019-12-10 16:03:33 +00:00
reserve Bug 22284: (QA follow-up) Make pickup locations be Koha::Library objects 2020-01-03 12:58:06 +00:00
reviews Bug 18789: Send Koha::Patron object to the templates 2018-02-16 13:03:58 -03:00
rotating_collections Bug 21500: Remove warnings in rotating collections 2018-10-09 15:02:45 +00:00
serials Bug 7047: Change ReNewSubscription prototype - use hashref 2019-12-23 12:06:45 +00:00
services Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
skel Bug 11078: Add locking to rebuild_zebra 2014-02-28 22:21:41 +00:00
suggestion Bug 14973: Fix edit a suggestion and dup found 2020-01-02 12:36:26 +00:00
svc Bug 23427: Simplify sort logic 2019-11-07 13:25:10 +00:00
t Bug 23934: Unit test 2020-01-10 16:19:35 +00:00
tags Bug 11529: Add templates for biblio title display. Unify display. 2019-08-05 15:03:19 +01:00
tmp/modified_authorities changing DO_NOT_REMOVE to README.txt 2007-10-21 19:14:41 -05:00
tools Bug 10352: Get add operations too 2020-01-10 08:37:19 +00:00
virtualshelves Bug 11529: Add templates for biblio title display. Unify display. 2019-08-05 15:03:19 +01:00
xt Bug 21576: Keep compatibility with QA script 2018-10-26 17:09:52 +00:00
.editorconfig Bug 12545: Add EditorConfig.org file to the source tree 2014-08-22 11:07:45 -03:00
.eslintrc.json Bug 23834: Add default ESLint configuration 2019-11-03 08:02:39 +00:00
.gitignore Bug 20427: Convert OPAC LESS to SCSS 2018-08-09 15:17:07 +00:00
.htaccess Fix file permissions: if it is not a script, it should not be executable. 2010-04-16 00:40:34 -04:00
.mailmap Update mailmap - Jonathan Druart 2017-06-21 12:42:19 -03:00
.scss-lint.yml Bug 21237: Clean up staff client SCSS 2018-08-24 16:23:25 +00:00
about.pl Bug 24327: Add warning to the about page is AnonSugggestions but AnonymousPatron 2020-01-08 14:13:28 +00:00
changelanguage.pl Bug 21299: (QA follow-up) Rename module and subroutine 2018-11-07 21:52:17 +00:00
fix-perl-path.PL Bug 9978: (followup) Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:43 -03:00
gulpfile.js Bug 21751: Replace fixFloat with HC-sticky to fix Chrome display 2019-02-04 14:13:35 +00:00
help.pl Bug 19817: Use the language from the interface if valid 2018-09-06 17:32:28 +00:00
INSTALL Bug 17626: Remove existing install instructions and link to the wiki pages instead 2016-11-22 11:29:07 +00:00
Koha.pm Bug 24206: DBRev 19.12.00.008 2020-01-10 16:12:38 +00:00
koha_perl_deps.pl Bug 20019: use Modern::Perl in misc perl scripts 2018-02-05 09:47:08 -03:00
kohaversion.pl Bug 13758: Move the Koha version from kohaversion.pl 2015-05-07 11:39:04 -03:00
LICENSE Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
mainpage.pl Bug 21907: Fix article requests count for non-superlibrarians 2019-02-04 14:50:40 +00:00
Makefile.PL Bug 23834: (RM follow-up) Add new file to Makefile.PL 2019-11-04 10:10:04 +00:00
MANIFEST.SKIP Bug 9546 : Updating make manifest tardist 2013-02-06 23:54:46 -05:00
package.json Bug 23025: security vulnerability detected in fstream < 1.0.12 defined in yarn.lock 2019-11-27 11:30:17 +00:00
README Bug 9440 - update Koha's LICENSE file from GPL2 to GPL3 2013-02-12 08:52:10 -05:00
README.md Bug 15465: Fix typo in bugs.k-c.org 2017-05-26 11:45:31 -03:00
README.robots Bug 6411 add another example to README.robots 2011-07-05 14:48:05 +12:00
rewrite-config.PL Bug 17851: Add elasticsearch config to koha-conf.xml 2019-10-07 14:09:10 +01:00
yarn.lock Bug 23025: Update yarn.lock 2019-11-27 11:30:17 +00:00

Koha is a free software integrated library system (ILS).

Koha is distributed under the GNU GPL version 3 or later.

Note: This is a synced mirror of the official Koha repo.

Note: Koha does not accept pull requests from git hosting sites.

Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.

For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch

The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook

http://koha-community.org/

Koha Logo