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

2020-02-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Lucas Gass  changed:

   What|Removed |Added

 CC||lu...@bywatersolutions.com
 Status|Pushed to stable|Pushed to oldstable
 Version(s)|20.05.00, 19.11.03  |20.05.00, 19.11.03,
released in||19.05.08

--- Comment #19 from Lucas Gass  ---
backported to 19.05.x for 19.05.08

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2020-01-30 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Joy Nelson  changed:

   What|Removed |Added

 Status|Pushed to master|Pushed to stable
 CC||j...@bywatersolutions.com
 Version(s)|20.05.00|20.05.00, 19.11.03
released in||

--- Comment #18 from Joy Nelson  ---
Pushed to 19.11.x branch for 19.11.03

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2020-01-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #17 from Martin Renvoize  ---
Nice work everyone!

Pushed to master for 20.05

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2020-01-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Martin Renvoize  changed:

   What|Removed |Added

 Status|Passed QA   |Pushed to master
 Version(s)||20.05.00
released in||

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2020-01-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Jonathan Druart  changed:

   What|Removed |Added

  Attachment #91308|0   |1
is obsolete||

--- Comment #16 from Jonathan Druart  
---
Created attachment 97198
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97198=edit
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 .

Signed-off-by: Johanna Raisa 

Signed-off-by: Jonathan Druart 
Test plan is wrong, but changes make sense

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2020-01-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Jonathan Druart  changed:

   What|Removed |Added

 Status|Signed Off  |Passed QA

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2019-10-29 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Martin Renvoize  changed:

   What|Removed |Added

   Severity|enhancement |normal
 CC||martin.renvoize@ptfs-europe
   ||.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2019-07-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Johanna Räisä  changed:

   What|Removed |Added

 Status|Needs Signoff   |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

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

2019-07-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Johanna Räisä  changed:

   What|Removed |Added

  Attachment #78327|0   |1
is obsolete||
 CC||johanna.ra...@koha-suomi.fi

--- Comment #15 from Johanna Räisä  ---
Created attachment 91308
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=91308=edit
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 .

Signed-off-by: Johanna Raisa 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

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

2018-11-20 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Joonas Kylmälä  changed:

   What|Removed |Added

 Status|BLOCKED |Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

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

2018-08-31 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Joonas Kylmälä  changed:

   What|Removed |Added

  Attachment #69338|0   |1
is obsolete||
 CC||joonas.kylm...@helsinki.fi

--- Comment #14 from Joonas Kylmälä  ---
Created attachment 78327
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78327=edit
Bug 17885: Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings
throws DBD::mysql Duplicate entry exceptions

I modified the patch to work with the recent Elasticsearch changes. Please
sign-off if you think it is fine. I will check up next the status of bug
#17897.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

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

2018-03-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Katrin Fischer  changed:

   What|Removed |Added

 CC||katrin.fisc...@bsz-bw.de
 Status|Signed Off  |BLOCKED

--- Comment #13 from Katrin Fischer  ---
Thx Nick for taking a look. Moving to BLOCKED for now, move back to Signed off
once dependency is resolved please.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2018-03-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Nick Clemens  changed:

   What|Removed |Added

 CC||n...@bywatersolutions.com

--- Comment #12 from Nick Clemens  ---
Should be QAed together with 17897 which contains the tests

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2018-02-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #11 from Alex Arnaud  ---
Hello Oli,

Could you please add unit tests for sub reset_elasticsearch_mappings? At least
to check that it deletes mappings as it is what you change in the behavior. But
more tests are welcome.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2018-02-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Alex Arnaud  changed:

   What|Removed |Added

 QA Contact||alex.arn...@biblibre.com
 CC||alex.arn...@biblibre.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-11-24 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

David Bourgault  changed:

   What|Removed |Added

 Status|Needs Signoff   |Signed Off

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-11-24 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

David Bourgault  changed:

   What|Removed |Added

  Attachment #58941|0   |1
is obsolete||

--- Comment #10 from David Bourgault  ---
Created attachment 69338
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69338=edit
Bug 17885 - Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings
throws DBD::mysql Duplicate entry exceptions

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.

Signed-off-by: David Bourgault 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-10-15 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Katrin Fischer  changed:

   What|Removed |Added

   Assignee|crazy.mental.on...@gmail.co |olli-antti.kivila...@jns.fi
   |m   |

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-09-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Jonathan Druart  changed:

   What|Removed |Added

 QA Contact|testo...@bugs.koha-communit |
   |y.org   |
  Component|Searching   |Searching - Elasticsearch

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-02-07 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885
Bug 17885 depends on bug 17255, which changed state.

Bug 17255 Summary: Upgrade Elastic Search code to work with version 5.1
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17255

   What|Removed |Added

 Status|Pushed to Master|RESOLVED
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-17 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Zoe Schoeler  changed:

   What|Removed |Added

   Assignee|gmcha...@gmail.com  |crazy.mental.on...@gmail.co
   ||m
 CC||crazy.mental.on...@gmail.co
   ||m

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Olli-Antti Kivilahti  changed:

   What|Removed |Added

 Blocks||17897


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17897
[Bug 17897] Koha::SearchMappingManager - Simplify search mapping modifications
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Olli-Antti Kivilahti  changed:

   What|Removed |Added

  Attachment #58940|0   |1
is obsolete||

--- Comment #9 from Olli-Antti Kivilahti  ---
Created attachment 58941
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=58941=edit
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_know_what_i_am_doing=1
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.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Olli-Antti Kivilahti  changed:

   What|Removed |Added

  Attachment #58825|0   |1
is obsolete||

--- Comment #8 from Olli-Antti Kivilahti  ---
Created attachment 58940
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=58940=edit
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_know_what_i_am_doing=1
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.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #7 from Olli-Antti Kivilahti  ---
I am not sure that separating them to separate bugs is the correct solution
here.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #6 from Olli-Antti Kivilahti  ---
Any suggestions for the title of the new refactorings bug?
It is all closely related to this if you take a loot at the tests.
Refactorings have been done so I can test this change.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #5 from Jonathan Druart  
---
Ok got it, so I guess it would be better to simply move the delete inside the
reset_elasticsearch_mappings.
And move the refactoring to another bug report.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #4 from Olli-Antti Kivilahti  ---
My modification preserves existing changes.
The way it works in the mappings.pl, is to drop all changes and add the
defaults.

I guess the original one is the desired behaviour.

But I strongly feel that the reset_elasticsearch_mappings()-subroutine needs to
perform on its own.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #3 from Olli-Antti Kivilahti  ---
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.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Jonathan Druart  changed:

   What|Removed |Added

 CC||jonathan.dru...@bugs.koha-c
   ||ommunity.org

--- Comment #2 from Jonathan Druart  
---
What are the steps to recreate?

select count(*) from search_marc_to_field;
 476

Hit
/cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl?op=reset_know_what_i_am_doing=1

=> no error.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Olli-Antti Kivilahti  changed:

   What|Removed |Added

 Depends on||17255


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17255
[Bug 17255] Upgrade Elastic Search code to work with version 5.1
-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

Olli-Antti Kivilahti  changed:

   What|Removed |Added

 Status|NEW |Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2017-01-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17885

--- Comment #1 from Olli-Antti Kivilahti  ---
Created attachment 58825
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=58825=edit
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 upserting those entries instead of adding them.

Also adds a Koha::SearchMappingManager to manage the complexities of CRUD:ing
these search mappings

Also adds nice tests to make sure the Manager and the
reset_elasticsearch_mappings() keep working
as expected.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/