Bugzilla – Attachment 82262 Details for
Bug 19893
Alternative optimized indexing for Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19893: Fix tests and add tests for joined subfields
Bug-19893-Fix-tests-and-add-tests-for-joined-subfi.patch (text/plain), 5.21 KB, created by
Martin Renvoize (ashimema)
on 2018-11-13 11:31:46 UTC
(
hide
)
Description:
Bug 19893: Fix tests and add tests for joined subfields
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-11-13 11:31:46 UTC
Size:
5.21 KB
patch
obsolete
>From bd4611ea648eaa3809305ca7776c9d0775592f77 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Wed, 12 Sep 2018 16:50:01 +0200 >Subject: [PATCH] Bug 19893: Fix tests and add tests for joined subfields > >Sponsored-by: Gothenburg University Library >Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/Koha/SearchEngine/Elasticsearch.t | 16 +++++++----- > .../Koha_SearchEngine_Elasticsearch_Search.t | 26 +------------------ > 2 files changed, 11 insertions(+), 31 deletions(-) > >diff --git a/t/Koha/SearchEngine/Elasticsearch.t b/t/Koha/SearchEngine/Elasticsearch.t >index 55cf89620e..f4fe4355fa 100644 >--- a/t/Koha/SearchEngine/Elasticsearch.t >+++ b/t/Koha/SearchEngine/Elasticsearch.t >@@ -145,7 +145,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > suggestible => 1, > sort => 1, > marc_type => 'marc21', >- marc_field => '245a', >+ marc_field => '245(ab)ab', > }, > { > name => 'unimarc_title', >@@ -228,7 +228,7 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > MARC::Field->new('100', '', '', a => 'Author 1'), > MARC::Field->new('110', '', '', a => 'Corp Author'), > MARC::Field->new('210', '', '', a => 'Title 1'), >- MARC::Field->new('245', '', '', a => 'Title: first record'), >+ MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), > MARC::Field->new('999', '', '', c => '1234567'), > # ' ' for testing trimming of white space in boolean value callback: > MARC::Field->new('952', '', '', 0 => ' ', g => '123.30'), >@@ -261,8 +261,8 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > is(scalar @{$docs->[0][1]->{author__sort}}, 2, 'First document author__sort field should have two values'); > is_deeply($docs->[0][1]->{author__sort}, ['Author 1', 'Corp Author'], 'First document author__sort field should be set correctly'); > >- is(scalar @{$docs->[0][1]->{title__sort}}, 1, 'First document title__sort field should have one value'); >- is_deeply($docs->[0][1]->{title__sort}, ['Title: first record'], 'First document title__sort field should be set correctly'); >+ is(scalar @{$docs->[0][1]->{title__sort}}, 3, 'First document title__sort field should have three values'); >+ is_deeply($docs->[0][1]->{title__sort}, ['Title:', 'first record', 'Title: first record'], 'First document title__sort field should be set correctly'); > > is(scalar @{$docs->[0][1]->{author__suggestion}}, 2, 'First document author__suggestion field should contain two values'); > is_deeply( >@@ -278,10 +278,14 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > 'First document author__suggestion field should be set correctly' > ); > >- is(scalar @{$docs->[0][1]->{title__suggestion}}, 1, 'First document title__suggestion field should contain one value'); >+ is(scalar @{$docs->[0][1]->{title__suggestion}}, 3, 'First document title__suggestion field should contain three values'); > is_deeply( > $docs->[0][1]->{title__suggestion}, >- [{ 'input' => 'Title: first record' }], >+ [ >+ { 'input' => 'Title:' }, >+ { 'input' => 'first record' }, >+ { 'input' => 'Title: first record' } >+ ], > 'First document title__suggestion field should be set correctly' > ); > >diff --git a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >index 0925322028..30e48cfe03 100644 >--- a/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >+++ b/t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 15; >+use Test::More tests => 13; > use t::lib::Mocks; > > use Koha::SearchEngine::Elasticsearch::QueryBuilder; >@@ -50,8 +50,6 @@ SKIP: { > > ok( my $results = $searcher->search( $query) , 'Do a search ' ); > >- ok( my $marc = $searcher->json2marc( $results->first ), 'Convert JSON to MARC'); >- > is (my $count = $searcher->count( $query ), 0 , 'Get a count of the results, without returning results '); > > ok ($results = $searcher->search_compat( $query ), 'Test search_compat' ); >@@ -69,28 +67,6 @@ SKIP: { > is ($searcher->max_result_window, 12000, 'max_result_window returns the correct value'); > } > >-subtest 'json2marc' => sub { >- plan tests => 4; >- my $leader = '00626nam a2200193 4500'; >- my $_001 = 42; >- my $_010a = '123456789'; >- my $_010d = 145; >- my $_200a = 'a title'; >- my $json = [ # It's not a JSON, see the POD of json2marc >- [ 'LDR', undef, undef, '_', $leader ], >- [ '001', undef, undef, '_', $_001 ], >- [ '010', ' ', ' ', 'a', $_010a, 'd', $_010d ], >- [ '200', '1', ' ', 'a', $_200a, ], # Yes UNIMARC but we don't mind here >- ]; >- >- my $marc = $searcher->json2marc( $json ); >- is( $marc->leader, $leader, ); >- is( $marc->field('001')->data, $_001, ); >- is( $marc->subfield('010', 'a'), $_010a, ); >- is( $marc->subfield('200', 'a'), $_200a, ); >- >-}; >- > subtest 'build_query tests' => sub { > plan tests => 24; > >-- >2.19.1
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 19893
:
70199
|
70200
|
70201
|
70202
|
70230
|
70325
|
73153
|
75109
|
75271
|
75272
|
75353
|
75428
|
75455
|
75588
|
75658
|
75660
|
76612
|
76613
|
76614
|
76629
|
78091
|
78092
|
78093
|
78094
|
78524
|
78561
|
78587
|
78588
|
78589
|
78590
|
78591
|
78592
|
78593
|
78594
|
78690
|
78691
|
78692
|
78693
|
78694
|
78695
|
78696
|
80969
|
80970
|
80971
|
80983
|
81014
|
81015
|
81284
|
81822
|
81901
|
81903
|
81955
|
81957
|
81958
|
81959
|
81960
|
81961
|
81962
|
81963
|
81964
|
81965
|
81966
|
82143
|
82144
|
82145
|
82146
|
82147
|
82148
|
82149
|
82150
|
82151
|
82152
|
82256
|
82257
|
82258
|
82259
|
82260
|
82261
| 82262 |
82263
|
82264
|
82265
|
82266
|
82267