Browse Source
Fixes handling of /0 selector in addition to several fixed field positions. Note that ff7-01-02 is in fact 00-01 in Zebra and that has been replicated here. Test plan: 1. Before applying a patch, check from Elasticsearch (e.g. localhost:9200/koha_biblios/_search?q=_id:123) what is indexed in Elasticsearch for a record for date-entered-on-file, ff7-00, ff7-01, ff7-02 and lleader. 2. Apply the patch, update database and save the record again. 3. Verify that the contents of the forementioned fields is now correct in Elasticsearch. 4. Verify that tests pass: prove -v t/Koha/SearchEngine/Elasticsearch.t Signed-off-by: Björn Nylén <bjorn.nylen@ub.lu.se> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>19.05.x
Ere Maijala
5 years ago
committed by
Nick Clemens
4 changed files with 83 additions and 16 deletions
@ -0,0 +1,55 @@ |
|||
$DBversion = 'XXX'; # will be replaced by the RM |
|||
if( CheckVersion( $DBversion ) ) { |
|||
$dbh->do( q| |
|||
UPDATE search_marc_map SET marc_field='007_/0' |
|||
WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/1' AND id IN |
|||
(SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN |
|||
(SELECT id FROM search_field WHERE label='ff7-00') |
|||
) |
|||
|); |
|||
|
|||
$dbh->do( q| |
|||
UPDATE search_marc_map SET marc_field='007_/1' |
|||
WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/2' AND id IN |
|||
(SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN |
|||
(SELECT id FROM search_field WHERE label='ff7-01') |
|||
) |
|||
|); |
|||
|
|||
$dbh->do( q| |
|||
UPDATE search_marc_map SET marc_field='007_/2' |
|||
WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/3' AND id IN |
|||
(SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN |
|||
(SELECT id FROM search_field WHERE label='ff7-02') |
|||
) |
|||
|); |
|||
|
|||
# N.B. ff7-01-02 really is 00-01! |
|||
$dbh->do( q| |
|||
UPDATE search_marc_map SET marc_field='007_/0-1' |
|||
WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/1-2' AND id IN |
|||
(SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN |
|||
(SELECT id FROM search_field WHERE label='ff7-01-02') |
|||
) |
|||
|); |
|||
|
|||
$dbh->do( q| |
|||
UPDATE search_marc_map SET marc_field='008_/0-5' |
|||
WHERE marc_type IN ('marc21', 'normarc') AND marc_field='008_/1-5' AND id IN |
|||
(SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN |
|||
(SELECT id FROM search_field WHERE label='date-entered-on-file') |
|||
) |
|||
|); |
|||
|
|||
$dbh->do( q| |
|||
UPDATE search_marc_map SET marc_field='leader_/0-4' |
|||
WHERE marc_type IN ('marc21', 'normarc') AND marc_field='leader_/1-5' AND id IN |
|||
(SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN |
|||
(SELECT id FROM search_field WHERE label='llength') |
|||
) |
|||
|); |
|||
|
|||
# Always end with this (adjust the bug info) |
|||
SetVersion( $DBversion ); |
|||
print "Upgrade to $DBversion done (Bug 22339 - Fix search field mappings of MARC fixed fields)\n"; |
|||
} |
Loading…
Reference in new issue