View | Details | Raw Unified | Return to bug 37821
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch.pm (-1 / +38 lines)
Lines 621-626 sub marc_records_to_documents { Link Here
621
                        $altscript = 1;
621
                        $altscript = 1;
622
                    }
622
                    }
623
                }
623
                }
624
                # Handle references to GEOGR_NAME authorities
625
                if ($marcflavour eq 'marc21' && $tag eq '651') {
626
                    $self->embed_geographic_name($field, $record_document, $data_fields_rules);
627
                }
624
628
625
                my $data_field_rules = $data_fields_rules->{$tag};
629
                my $data_field_rules = $data_fields_rules->{$tag};
626
                if ($data_field_rules) {
630
                if ($data_field_rules) {
Lines 853-858 sub marc_records_to_documents { Link Here
853
    return \@record_documents;
857
    return \@record_documents;
854
}
858
}
855
859
860
sub embed_geographic_name {
861
    my ($self, $field, $record_document, $rules) = @_;
862
863
    my $authid = $field->subfield('9');
864
    return unless $authid;
865
    my $authority = Koha::MetadataRecord::Authority->get_from_authid($authid);
866
    return unless $authority;
867
868
    my $tag = '034';
869
870
    my $auth_marc = $authority->record;
871
    my @coordinate_fields = $auth_marc->field($tag);
872
873
    for my $field (@coordinate_fields) {
874
        my $data_field_rules = $rules->{$tag};
875
        if ($data_field_rules) {
876
            my $subfields_mappings = $data_field_rules->{subfields};
877
            my $wildcard_mappings = $subfields_mappings->{'*'};
878
            foreach my $subfield ($field->subfields()) {
879
                my ($code, $data) = @{$subfield};
880
                my $mappings = $subfields_mappings->{$code} // [];
881
                if (@{$mappings}) {
882
                    $self->_process_mappings($mappings, $data, $record_document, {
883
                            data_source => 'subfield',
884
                            code => $code,
885
                            field => $field
886
                        }
887
                    );
888
                }
889
            }
890
        }
891
    }
892
}
893
856
=head2 _marc_to_array($record)
894
=head2 _marc_to_array($record)
857
895
858
    my @fields = _marc_to_array($record)
896
    my @fields = _marc_to_array($record)
859
- 

Return to bug 37821