Bug 31471: Send multiple ISBN with 'OR' for FindDuplicate
When a record has multiple ISBNs the database stores them seperated by a pipe Zebra interprets a string like "isbn:1600213510 | 9781600213519" as an 'OR' search, but for Elasticsearch we need to explicitly send "OR" - and Zebra support this as well To test: 1 - Make sure you are using Elasticsearch 2 - Cataloging->Add a new record from Z3950 3 - Choose target: LOC 4 - Search for: Control number: 14455023 5 - Import and save 6 - Search for the record again 7 - Import and save - duplicate check isn't been triggered 8 - Apply patch 9 - restart_all 10 - repeat 2-7 11 - this time you should get a duplicate notification 12 - Sitch SearchEngine syspref to 'Zebra' 13 - repeat 2-7 14 - Ensure you still get duplicate notification Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit2dafd6f749) Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com> (cherry picked from commit47ad3dd1b2) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit26d9092de4) Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
parent
b5a3c68737
commit
a0aa2ff4af
|
|
@ -93,6 +93,7 @@ sub FindDuplicate {
|
|||
if ( $result->{isbn} ) {
|
||||
$result->{isbn} =~ s/\(.*$//;
|
||||
$result->{isbn} =~ s/\s+$//;
|
||||
$result->{isbn} =~ s/\|/OR/;
|
||||
$query = "isbn:$result->{isbn}";
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -291,6 +291,15 @@ sub run_marc21_search_tests {
|
|||
($biblionumber,undef,$title) = FindDuplicate($record);
|
||||
is($biblionumber, 51, 'Found duplicate with ISBN');
|
||||
|
||||
$record = MARC::Record->new;
|
||||
$record->add_fields(
|
||||
[ '020', ' ', ' ', a => '0465039146' ],
|
||||
[ '020', ' ', ' ', a => '9780465039142' ],
|
||||
[ '245', '0', '0', a => 'Doesnt matter, searching isbn /' ]
|
||||
);
|
||||
($biblionumber,undef,$title) = FindDuplicate($record);
|
||||
is($biblionumber, 48, 'Found duplicate with ISBN when two ISBNs in record');
|
||||
|
||||
$record = MARC::Record->new;
|
||||
|
||||
$record->add_fields(
|
||||
|
|
@ -916,7 +925,7 @@ sub run_unimarc_search_tests {
|
|||
}
|
||||
|
||||
subtest 'MARC21 + DOM' => sub {
|
||||
plan tests => 93;
|
||||
plan tests => 94;
|
||||
run_marc21_search_tests();
|
||||
};
|
||||
|
||||
|
|
@ -927,7 +936,7 @@ subtest 'UNIMARC + DOM' => sub {
|
|||
|
||||
|
||||
subtest 'FindDuplicate' => sub {
|
||||
plan tests => 6;
|
||||
plan tests => 8;
|
||||
Koha::Caches->get_instance('config')->flush_all;
|
||||
t::lib::Mocks::mock_preference('marcflavour', 'MARC21' );
|
||||
mock_GetMarcSubfieldStructure('MARC21');
|
||||
|
|
@ -956,6 +965,13 @@ subtest 'FindDuplicate' => sub {
|
|||
$record_3->add_fields(
|
||||
[ '245', '0', '0', a => 'Frog and toad all year /' ]
|
||||
);
|
||||
my $record_4 = MARC::Record->new;
|
||||
$record_4 ->add_fields(
|
||||
[ '020', ' ', ' ', a => '9780307744432' ],
|
||||
[ '020', ' ', ' ', a => '0307744434' ],
|
||||
[ '100', '0', '0', a => 'Morgenstern, Erin' ],
|
||||
[ '245', '0', '0', a => 'The night circus /' ]
|
||||
);
|
||||
|
||||
foreach my $engine ('Zebra','Elasticsearch'){
|
||||
t::lib::Mocks::mock_preference('searchEngine', $engine );
|
||||
|
|
@ -968,6 +984,9 @@ subtest 'FindDuplicate' => sub {
|
|||
|
||||
warning_is { C4::Search::FindDuplicate($record_3);}
|
||||
q/ti,ext:"Frog and toad all year \/"/,"Term correctly formed and passed to $engine";
|
||||
|
||||
warning_is { C4::Search::FindDuplicate($record_4);}
|
||||
q/isbn:9780307744432 OR 0307744434/,"Term correctly formed and passed to $engine";
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue