Bugzilla – Attachment 170979 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: Embed geographic coordinates from GEOGR_NAME authority when indexing records
Bug-37821-Embed-geographic-coordinates-from-GEOGRN.patch (text/plain), 2.43 KB, created by
HKS3 Tadeusz Sośnierz
on 2024-09-03 11:55:33 UTC
(
hide
)
Description:
Bug 37821: Embed geographic coordinates from GEOGR_NAME authority when indexing records
Filename:
MIME Type:
Creator:
HKS3 Tadeusz Sośnierz
Created:
2024-09-03 11:55:33 UTC
Size:
2.43 KB
patch
obsolete
>From 701ce9806f5fbf39c5cb3e2e20ce62dc79e4fde5 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: Tue, 3 Sep 2024 13:53:58 +0200 >Subject: [PATCH] Bug 37821: Embed geographic coordinates from GEOGR_NAME > authority when indexing records > >--- > Koha/SearchEngine/Elasticsearch.pm | 38 ++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 5ef5235720..ca6975c0f5 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -621,6 +621,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); >+ } > > my $data_field_rules = $data_fields_rules->{$tag}; > if ($data_field_rules) { >@@ -853,6 +857,40 @@ sub marc_records_to_documents { > return \@record_documents; > } > >+sub embed_geographic_name { >+ my ($self, $field, $record_document, $rules) = @_; >+ >+ my $authid = $field->subfield('9'); >+ return unless $authid; >+ my $authority = Koha::MetadataRecord::Authority->get_from_authid($authid); >+ return unless $authority; >+ >+ my $tag = '034'; >+ >+ 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 $mappings = $subfields_mappings->{$code} // []; >+ if (@{$mappings}) { >+ $self->_process_mappings($mappings, $data, $record_document, { >+ data_source => 'subfield', >+ code => $code, >+ field => $field >+ } >+ ); >+ } >+ } >+ } >+ } >+} >+ > =head2 _marc_to_array($record) > > my @fields = _marc_to_array($record) >-- >2.45.2
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