|
Lines 115-126
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
| 115 |
|
115 |
|
| 116 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
116 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
| 117 |
|
117 |
|
| 118 |
plan tests => 30; |
118 |
plan tests => 32; |
| 119 |
|
119 |
|
| 120 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
120 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
| 121 |
|
121 |
|
| 122 |
my @mappings = ( |
122 |
my @mappings = ( |
| 123 |
{ |
123 |
{ |
|
|
124 |
name => 'isbn', |
| 125 |
type => 'isbn', |
| 126 |
facet => 0, |
| 127 |
suggestible => 0, |
| 128 |
sort => 0, |
| 129 |
marc_type => 'marc21', |
| 130 |
marc_field => '020a', |
| 131 |
}, |
| 132 |
{ |
| 124 |
name => 'author', |
133 |
name => 'author', |
| 125 |
type => 'string', |
134 |
type => 'string', |
| 126 |
facet => 1, |
135 |
facet => 1, |
|
Lines 225-230
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 225 |
my $marc_record_1 = MARC::Record->new(); |
234 |
my $marc_record_1 = MARC::Record->new(); |
| 226 |
$marc_record_1->leader(' cam 22 a 4500'); |
235 |
$marc_record_1->leader(' cam 22 a 4500'); |
| 227 |
$marc_record_1->append_fields( |
236 |
$marc_record_1->append_fields( |
|
|
237 |
MARC::Field->new('020', '', '', a => '1-56619-909-3'), |
| 228 |
MARC::Field->new('100', '', '', a => 'Author 1'), |
238 |
MARC::Field->new('100', '', '', a => 'Author 1'), |
| 229 |
MARC::Field->new('110', '', '', a => 'Corp Author'), |
239 |
MARC::Field->new('110', '', '', a => 'Corp Author'), |
| 230 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
240 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
|
Lines 250-256
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 250 |
my $docs = $see->marc_records_to_documents($records); |
260 |
my $docs = $see->marc_records_to_documents($records); |
| 251 |
|
261 |
|
| 252 |
# First record: |
262 |
# First record: |
| 253 |
|
|
|
| 254 |
is(scalar @{$docs}, 2, 'Two records converted to documents'); |
263 |
is(scalar @{$docs}, 2, 'Two records converted to documents'); |
| 255 |
|
264 |
|
| 256 |
is($docs->[0][0], '1234567', 'First document biblionumber should be set as first element in document touple'); |
265 |
is($docs->[0][0], '1234567', 'First document biblionumber should be set as first element in document touple'); |
|
Lines 329-334
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
| 329 |
'First document type_of_record_and_bib_level field should be set correctly' |
338 |
'First document type_of_record_and_bib_level field should be set correctly' |
| 330 |
); |
339 |
); |
| 331 |
|
340 |
|
|
|
341 |
is(scalar @{$docs->[0][1]->{isbn}}, 4, 'First document isbn field should contain four values'); |
| 342 |
is_deeply($docs->[0][1]->{isbn}, ['978-1-56619-909-4', '9781566199094', '1-56619-909-3', '1566199093'], 'First document isbn field should be set correctly'); |
| 343 |
|
| 332 |
# Second record: |
344 |
# Second record: |
| 333 |
|
345 |
|
| 334 |
is(scalar @{$docs->[1][1]->{author}}, 1, 'Second document author field should contain one value'); |
346 |
is(scalar @{$docs->[1][1]->{author}}, 1, 'Second document author field should contain one value'); |
| 335 |
- |
|
|