Bugzilla – Attachment 183219 Details for
Bug 37821
Embed geographic coordinates when indexing biblios linked to GEOGR_NAME authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37821: POD and tidying
Bug-37821-POD-and-tidying.patch (text/plain), 3.49 KB, created by
Roman Dolny
on 2025-06-12 21:10:14 UTC
(
hide
)
Description:
Bug 37821: POD and tidying
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2025-06-12 21:10:14 UTC
Size:
3.49 KB
patch
obsolete
>From f0cc2c79ab15cfb1bab0c043dc29f688f4bc1021 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tadeusz=20=E2=80=9Etadzik=E2=80=9D=20So=C5=9Bnierz?= > <tadeusz@sosnierz.com> >Date: Wed, 11 Jun 2025 14:05:32 +0200 >Subject: [PATCH] Bug 37821: POD and tidying > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > Koha/SearchEngine/Elasticsearch.pm | 52 +++++++++++++++++++++++------- > 1 file changed, 41 insertions(+), 11 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index c5fb74d8c4..a36b1fb3e4 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -697,9 +697,10 @@ sub marc_records_to_documents { > $altscript = 1; > } > } >+ > # Handle references to GEOGR_NAME authorities >- if ($marcflavour eq 'marc21' && $tag eq '651') { >- $self->embed_geographic_name($field, $record_document, $data_fields_rules); >+ if ( $marcflavour eq 'marc21' && $tag eq '651' ) { >+ $self->embed_geographic_name( $field, $record_document, $data_fields_rules ); > } > > my $data_field_rules = $data_fields_rules->{$tag}; >@@ -983,8 +984,33 @@ sub marc_records_to_documents { > return \@record_documents; > } > >+=head2 embed_geographic_name($field, $record_document, $rules) >+ >+ $self->embed_geographic_name( $field, $record_document, $data_fields_rules ); >+ >+Extract geographic fields from an authority linked to a given record >+ >+=over 4 >+ >+=item C<$field> >+ >+MARC::Field refering to the GEOGR_NAME authority >+ >+=item C<$record_document> >+ >+Hashref representing the Elasticsearch document on which mappings should be >+applied. >+ >+=item C<$rules> >+ >+MARC mapping rules for the provided field. >+ >+=back >+ >+=cut >+ > sub embed_geographic_name { >- my ($self, $field, $record_document, $rules) = @_; >+ my ( $self, $field, $record_document, $rules ) = @_; > > my $authid = $field->subfield('9'); > return unless $authid; >@@ -993,22 +1019,26 @@ sub embed_geographic_name { > > my $tag = '034'; > >- my $auth_marc = $authority->record; >+ my $auth_marc = $authority->record; > my @coordinate_fields = $auth_marc->field($tag); > > for my $field (@coordinate_fields) { > my $data_field_rules = $rules->{$tag}; > if ($data_field_rules) { > my $subfields_mappings = $data_field_rules->{subfields}; >- my $wildcard_mappings = $subfields_mappings->{'*'}; >- foreach my $subfield ($field->subfields()) { >- my ($code, $data) = @{$subfield}; >+ my $wildcard_mappings = $subfields_mappings->{'*'}; >+ foreach my $subfield ( $field->subfields() ) { >+ my ( $code, $data ) = @{$subfield}; > my $mappings = $subfields_mappings->{$code} // []; >- if (@{$mappings}) { >- $self->_process_mappings($mappings, $data, $record_document, { >+ if ( @{$mappings} ) { >+ $self->_process_mappings( >+ $mappings, >+ $data, >+ $record_document, >+ { > data_source => 'subfield', >- code => $code, >- field => $field >+ code => $code, >+ field => $field > } > ); > } >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37821
:
170979
|
183156
|
183157
|
183218
| 183219