The code could be able to inject mappings and weight if a mapping in mappings.yaml file contains boost-in-simple-search: Exemple: Personal-name: label: Personal-name mappings: - facet: '' marc_field: 100abcdefghjklmnopqrstvxyz marc_type: marc21 sort: ~ suggestible: '' - facet: '' marc_field: 100abcdefghjklmnopqrstvxyz marc_type: normarc sort: ~ suggestible: '' type: '' boost-in-simple-search: 4 4 is added in field weight in table search_field.
(Maybe an enhancement could be : ``` mappings: - ... settings: boost-in-simple-search: 4 ``` in replacement of ``` mappings: - ... boost-in-simple-search: 4 ``` but not sure)
Created attachment 74805 [details] [review] Bug 20607 - Make Koha::SearchEngine::Elasticsearch::reset_elasticsearch_mappings take weight into account Test plan: - apply BZ 18316 and this one, - update DB and schema files, - edit admin/searchengine/elasticsearch/mappings.yaml to add weight for some fields, - go to admin > search engine configuration, - reset your mappings (add ?op=reset&i_know_what_i_am_doing=1 to url), - check that weights you've added are set
The functionality works but the tests fail due to the weight is beeing returned as a decimal number. # Failed test 'Match search field is weighted with 15' # at t/db_dependent/Koha/SearchEngine/Elasticsearch/Reset.t line 61. # got: '15.00' # expected: '15' # Failed test 'Title search field is weighted with 20' # at t/db_dependent/Koha/SearchEngine/Elasticsearch/Reset.t line 64. # got: '20.00' # expected: '20' # Looks like you failed 2 tests of 4.
Alex, can you rebase this bug on master? Thank you.
Created attachment 87402 [details] [review] Bug 20607 - Make Koha::SearchEngine::Elasticsearch::reset_elasticsearch_mappings take weight into account Test plan: - apply this patch, - edit admin/searchengine/elasticsearch/mappings.yaml to add weight for some fields, - go to admin > search engine configuration, - reset your mappings (add ?op=reset&i_know_what_i_am_doing=1 to url), - check that weights you've added are set
(In reply to Michal Denar from comment #4) > Alex, can you rebase this bug on master? > > Thank you. Done! Thank you for reminding me of that BZ
Created attachment 87874 [details] [review] Bug 20607 - Make Koha::SearchEngine::Elasticsearch::reset_elasticsearch_mappings take weight into account Test plan: - apply this patch, - edit admin/searchengine/elasticsearch/mappings.yaml to add weight for some fields, - go to admin > search engine configuration, - reset your mappings (add ?op=reset&i_know_what_i_am_doing=1 to url), - check that weights you've added are set Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Patches work, however, the tests delete all my data, then start a transaction at the end? QA tool doesn't like commit title
Created attachment 91560 [details] [review] Bug 20607: Make Koha::SearchEngine::Elasticsearch::reset_elasticsearch_mappings take weight into account Test plan: - apply this patch, - edit admin/searchengine/elasticsearch/mappings.yaml to add weight for some fields, - go to admin > search engine configuration, - reset your mappings (add ?op=reset&i_know_what_i_am_doing=1 to url), - check that weights you've added are set Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 91561 [details] [review] Bug 20607: (QA follow-up) Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Nice work! Pushed to master for 19.11.00
Pushed to 19.05.x for 19.05.03