Bugzilla – Attachment 110004 Details for
Bug 24807
Add "year" type to improve sorting by publication date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24807: (follow-up) Add support for spaces as unknown characters
Bug-24807-follow-up-Add-support-for-spaces-as-unkn.patch (text/plain), 3.58 KB, created by
Katrin Fischer
on 2020-09-12 22:31:01 UTC
(
hide
)
Description:
Bug 24807: (follow-up) Add support for spaces as unknown characters
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-09-12 22:31:01 UTC
Size:
3.58 KB
patch
obsolete
>From 1dade70d7650e92287d4fa0cc22eb4e769c9fdee Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 10 Jul 2020 13:15:58 +0000 >Subject: [PATCH] Bug 24807: (follow-up) Add support for spaces as unknown > characters > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/SearchEngine/Elasticsearch.pm | 2 +- > t/db_dependent/Koha/SearchEngine/Elasticsearch.t | 26 +++++++++++++++++++++--- > 2 files changed, 24 insertions(+), 4 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 46c267101b..1df589c07c 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -909,7 +909,7 @@ sub _field_mappings { > push @{$default_options->{value_callbacks}}, sub { > my ($value) = @_; > # Replace "u" with "0" for sorting >- return map { s/[u]/0/gr } ( $value =~ /[0-9u]{4}/g ); >+ return map { s/[u\s]/0/gr } ( $value =~ /[0-9u\s]{4}/g ); > }; > } > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >index 2030bb7e5a..96c8eda321 100755 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >@@ -132,7 +132,7 @@ subtest 'get_elasticsearch_mappings() tests' => sub { > > subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { > >- plan tests => 58; >+ plan tests => 59; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); >@@ -375,14 +375,26 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > MARC::Field->new('999', '', '', c => '1234568'), > MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno), > ); >- my $records = [ $marc_record_1, $marc_record_2 ]; >+ >+ my $marc_record_3 = MARC::Record->new(); >+ $marc_record_3->leader(' cam 22 a 4500'); >+ $marc_record_3->append_fields( >+ MARC::Field->new('008', '901111s19uu xxk|||| |00| ||eng c'), >+ MARC::Field->new('100', '', '', a => 'Author 2'), >+ # MARC::Field->new('210', '', '', a => 'Title 3'), >+ # MARC::Field->new('245', '', '', a => 'Title: third record'), >+ MARC::Field->new('260', '', '', a => 'New York :', b => 'Ace ,', c => ' 89 '), >+ MARC::Field->new('999', '', '', c => '1234568'), >+ MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno), >+ ); >+ my $records = [$marc_record_1, $marc_record_2, $marc_record_3]; > > $see->get_elasticsearch_mappings(); #sort_fields will call this and use the actual db values unless we call it first > > my $docs = $see->marc_records_to_documents($records); > > # First record: >- is(scalar @{$docs}, 2, 'Two records converted to documents'); >+ is(scalar @{$docs}, 3, 'Two records converted to documents'); > > is_deeply($docs->[0]->{control_number}, ['123'], 'First record control number should be set correctly'); > >@@ -541,6 +553,14 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > 'Second document date-of-publication field should be set correctly' > ); > >+ # Third record: >+ >+ is_deeply( >+ $docs->[2]->{'copydate'}, >+ ['0890'], >+ 'Third document copydate field should be set correctly' >+ ); >+ > # Mappings marc_type: > > ok(!(defined $docs->[0]->{unimarc_title}), "No mapping when marc_type doesn't match marc flavour"); >-- >2.11.0
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 24807
:
100170
|
100171
|
100176
|
102547
|
102548
|
103084
|
103085
|
103086
|
103087
|
103163
|
103277
|
104525
|
104526
|
104527
|
104528
|
104529
|
104530
|
104531
|
106768
|
108382
|
108383
|
108384
|
108385
|
108386
|
108387
|
108388
|
108389
|
109997
|
109998
|
109999
|
110000
|
110001
|
110002
|
110003
| 110004 |
110355
|
110884