Add a new hook elasticsearch_to_document in order to allow completing the 'document' to be sent to Elasticsearch. Usage example: (1) add new search fields, (2) normalize/sanitize existing fields, (3) use id fields to retrieve info via web services in other repositories (say VIAF), (4) download file referenced in a field, and index its content.
Close to bug 31897
Created attachment 163962 [details] [review] Bug 36433: UT
Created attachment 163963 [details] [review] Bug 36433: Plugin hook elasticsearch_to_document Add a new hook elasticsearch_to_document in order to allow completing the 'document' to be sent to Elasticsearch. Usage example: (1) add new search fields, (2) normalize/sanitize existing fields, (3) use id fields to retrieve info via web services in other repositories (say VIAF), (4) download file referenced in a field, and index its content. To test: 1. Apply the unit tests patch, and run it: prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t => FAIL: Tests fail! The hook is not implemented so the desired 2. Apply this patch, and then repeat 1: => SUCCESS: It works!
Created attachment 172062 [details] [review] Bug 36433: UT Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Created attachment 172063 [details] [review] Bug 36433: Plugin hook elasticsearch_to_document Add a new hook elasticsearch_to_document in order to allow completing the 'document' to be sent to Elasticsearch. Usage example: (1) add new search fields, (2) normalize/sanitize existing fields, (3) use id fields to retrieve info via web services in other repositories (say VIAF), (4) download file referenced in a field, and index its content. To test: 1. Apply the unit tests patch, and run it: prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t => FAIL: Tests fail! The hook is not implemented so the desired 2. Apply this patch, and then repeat 1: => SUCCESS: It works! Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Created attachment 176749 [details] [review] Bug 36433: UT Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 176750 [details] [review] Bug 36433: Plugin hook elasticsearch_to_document Add a new hook elasticsearch_to_document in order to allow completing the 'document' to be sent to Elasticsearch. Usage example: (1) add new search fields, (2) normalize/sanitize existing fields, (3) use id fields to retrieve info via web services in other repositories (say VIAF), (4) download file referenced in a field, and index its content. To test: 1. Apply the unit tests patch, and run it: prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t => FAIL: Tests fail! The hook is not implemented so the desired 2. Apply this patch, and then repeat 1: => SUCCESS: It works! Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Please update https://wiki.koha-community.org/wiki/Koha_Plugin_Hooks!
Pushed for 25.05! Well done everyone, thank you!
Thanks. Wiki page updated.
(In reply to Frédéric Demians from comment #12) > Thanks. Wiki page updated. +1
This makes one of the tests on Jenkins fail, please check and fix: https://jenkins.koha-community.org/job/Koha_Main_D11/lastCompletedBuild/testReport/(root)/t_db_dependent_Koha_Plugins_Biblio_and_Items_plugin_hooks_t/No_tests_run_for_subtest__elasticsearch_to_document___hooks_tests___1937_/
(In reply to Katrin Fischer from comment #14) > This makes one of the tests on Jenkins fail, please check and fix: Thanks. This is the group of tests introduced by this patch which are not executed by Jenkins, apparently. I can't reproduce on my box. I make the assumption that it is due to the lack of a db transaction rollback, and propose a fix. Hope that's it.
Created attachment 178685 [details] [review] Bug 36433: fix test failing on Jenkins Transaction rollback not called.
Thanks, Frederic, let's try with your patch!
Created attachment 178778 [details] [review] Bug 36433: (follow-up) Include required library Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Follow-up "Include required library" pushed to main.