Bug 38729: Linker should consider diacritics
Currently, Koha linker does not pay attention to the diacritics while
linking--the decision about linking is taken based on the results of
search in the search engine (be it Zebra or Elasticsearch) which are
diacritics insensitive. As a consequence, "Brückner, Karl" could be
erroneously linked to "Bruckner, Karl", in case when "Brückner, Karl"
did not exist in the authority file, or no link would be made in case
when both "Brückner, Karl" and "Bruckner, Karl" existed in the authority
file and LinkerModule is set to 'default'.
Test plan:
==========
1. Make sure that LinkerModule system preference is set to default.
2. Create an authority record of type PERSO_NAME with a name containing
diacritics (e.g. "Brückner, Karl" , or "Rąkowski, Albin" etc.).
3. Edit an existing or create a new bibliographic record and put in a
personal name field (100, 600, 700) that name without diacritics.
4. Click "Link authorities automatically" -- the two different names will
be linked, which is wrong.
5. Create a second authority record with name form exactly from the
bibliographic record (without diacritics).
6. Edit an existing or create a new bibliographic record and put in a
personal name field (100, 600, 700) the name without diacritics.
7. Click "Link authorities automatically" -- you should get a message
"More than one local match found. Possibly a duplicate authority!".
8. Apply the patch ; updatedatabase ; restart_all
9. Set the LinkerConsiderDiacritics systempreference to 'Do'.
10. Choose another name pair with and without diacritics. Repeat p. 3-4.
The bibliographic field should not be linked this time.
11. With the new pair, repeat p. 5.-7. The bibliographic field should
now be correctly linked.
Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
a224711e77
commit
c0fc7eae32
|
|
@ -148,7 +148,11 @@ sub authorities {
|
|||
my $self = shift;
|
||||
my $skipmetadata = shift;
|
||||
my ( $results, $total ) = _search( $self, 'match-heading', $skipmetadata );
|
||||
return $results;
|
||||
if ( C4::Context->preference('LinkerConsiderDiacritics') ) {
|
||||
return $self->_filter_diacritics($results);
|
||||
} else {
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
=head2 valid_heading_subfield
|
||||
|
|
@ -249,6 +253,29 @@ sub _search {
|
|||
|
||||
}
|
||||
|
||||
=head2 _filter_diacritics
|
||||
|
||||
=cut
|
||||
|
||||
sub _filter_diacritics {
|
||||
my $self = shift;
|
||||
my $results = shift;
|
||||
my $exact_matched_auths = [];
|
||||
for my $matched_auth (@$results) {
|
||||
my $auth = Koha::Authorities->find( $matched_auth->{authid} );
|
||||
next unless $auth;
|
||||
my $authrec = $auth->record;
|
||||
my $auth_tag_to_report = Koha::Authority::Types->find( $self->{auth_type} )->auth_tag_to_report;
|
||||
my $auth_heading_field = $authrec->field($auth_tag_to_report);
|
||||
$auth_heading_field->set_tag( $self->field->tag );
|
||||
my $auth_heading = C4::Heading->new_from_field($auth_heading_field);
|
||||
if ( $auth_heading->search_form eq $self->search_form ) {
|
||||
push @$exact_matched_auths, $matched_auth;
|
||||
}
|
||||
}
|
||||
return $exact_matched_auths;
|
||||
}
|
||||
|
||||
=head1 INTERNAL FUNCTIONS
|
||||
|
||||
=head2 _marc_format_handler
|
||||
|
|
|
|||
Loading…
Reference in New Issue