Bug 39158

Summary: Reduce code duplication in marc_records_to_documents
Product: Koha Reporter: David Gustafsson <glasklas>
Component: Searching - ElasticsearchAssignee: David Gustafsson <glasklas>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 39158: Reduce code duplication in marc_records_to_documents

Description David Gustafsson 2025-02-18 22:53:50 UTC
There is currently a block in Koha::SearchEngine::Elasticsearch::marc_records_to_documents that in my opinion should be brokwn out to its own method for increased maintainability and readability. It's easily done that these two blocks will drift apart with time (when they should be the same), fixing a bug in one place, forgetting in another etc. Here is a patch to fix this.
Comment 1 David Gustafsson 2025-02-18 23:01:25 UTC
Created attachment 178302 [details] [review]
Bug 39158: Reduce code duplication in marc_records_to_documents

Refactor marc_record_to_documents to avoid code duplicaiton.

To test:
1) Verify tests in t/db_dependant/Koha/SearchEngine/Elasticsearch.t all
   pass
2) Apply patch
3) Veriy tests in t/db_dependant/Koha/SearchEngine/Elasticsearch.t
   still pass