Bugzilla – Attachment 175284 Details for
Bug 38101
ES skips records with huge fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38101: Regression tests
Bug-38101-Regression-tests.patch (text/plain), 3.13 KB, created by
David Cook
on 2024-12-08 23:28:26 UTC
(
hide
)
Description:
Bug 38101: Regression tests
Filename:
MIME Type:
Creator:
David Cook
Created:
2024-12-08 23:28:26 UTC
Size:
3.13 KB
patch
obsolete
>From 186e4bd4aa618d32d427f6e6e66f4c84f6ec3136 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 6 Dec 2024 11:22:14 -0300 >Subject: [PATCH] Bug 38101: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > .../Koha/SearchEngine/Elasticsearch.t | 29 ++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >index 24159799f8..0abdf47001 100755 >--- a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >+++ b/t/db_dependent/Koha/SearchEngine/Elasticsearch.t >@@ -186,7 +186,7 @@ subtest 'get_elasticsearch_mappings() tests' => sub { > > subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { > >- plan tests => 69; >+ plan tests => 70; > > t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709'); >@@ -393,6 +393,16 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > marc_type => 'marc21', > marc_field => '650(avxyz)', > }, >+ { >+ name => 'note', >+ type => 'string', >+ facet => 0, >+ suggestible => 0, >+ searchable => 1, >+ sort => 1, >+ marc_type => 'marc21', >+ marc_field => '522a', >+ }, > ); > > my $se = Test::MockModule->new('Koha::SearchEngine::Elasticsearch'); >@@ -755,15 +765,32 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' > my $marc_record_with_large_field = MARC::Record->new(); > $marc_record_with_large_field->leader(' cam 22 a 4500'); > >+ my $xs = 'X' x 8191; >+ my $ys = 'Y' x 8191; >+ my $zs = 'Z' x 8191 . 'W'; # one extra character so it needs splitting >+ > $marc_record_with_large_field->append_fields( > MARC::Field->new( '100', '', '', a => 'Author 1' ), > MARC::Field->new( '245', '', '', a => 'Title:', b => 'record with large field' ), > MARC::Field->new( '500', '', '', a => 'X' x 15000 ), >+ MARC::Field->new( '522', '', '', a => "$xs $ys $zs" ), > MARC::Field->new( '999', '', '', c => '1234567' ), > ); > > $docs = $see->marc_records_to_documents( [$marc_record_with_large_field] ); > >+ subtest '_process_mappings() split tests' => sub { >+ >+ plan tests => 4; >+ >+ my $note_indexes = $docs->[0]->{note}; >+ >+ is( $note_indexes->[0], $xs, 'First chunk split using the space' ); >+ is( $note_indexes->[1], $ys, 'Second chunk split using the space' ); >+ is( $note_indexes->[2], substr( $zs, 0, 8191 ), 'Third chunk is forced to split' ); >+ is( $note_indexes->[3], substr( $zs, 8191, 1 ), 'Fourth chunk is just the remaining char' ); >+ }; >+ > is( $docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly' ); > > $decoded_marc_record = $see->decode_record_from_result( $docs->[0] ); >-- >2.39.5
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 38101
:
172428
|
174247
|
175260
|
175261
| 175284 |
175285