| 
      
            Lines 117-123
          subtest 'get_elasticsearch_mappings() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 117 | 
           | 
          117 | 
           | 
        
        
          | 118 | 
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { | 
          118 | 
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { | 
        
        
          | 119 | 
           | 
          119 | 
           | 
        
          
            
              | 120 | 
                  plan tests => 47;  | 
              120 | 
                  plan tests => 49;  | 
            
        
          | 121 | 
           | 
          121 | 
           | 
        
        
          | 122 | 
              t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); | 
          122 | 
              t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); | 
        
        
          | 123 | 
           | 
          123 | 
           | 
        
  
    | 
      
            Lines 213-218
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 213 | 
                      marc_field => '9520',  | 
          213 | 
                      marc_field => '9520',  | 
        
        
          | 214 | 
                  },  | 
          214 | 
                  },  | 
        
        
          | 215 | 
                  { | 
          215 | 
                  { | 
        
            
               | 
               | 
              216 | 
                          name => 'local_classification',  | 
            
            
              | 217 | 
                          type => 'string',  | 
            
            
              | 218 | 
                          facet => 0,  | 
            
            
              | 219 | 
                          suggestible => 0,  | 
            
            
              | 220 | 
                          sort => 1,  | 
            
            
              | 221 | 
                          marc_type => 'marc21',  | 
            
            
              | 222 | 
                          marc_field => '952o',  | 
            
            
              | 223 | 
                      },  | 
            
            
              | 224 | 
                      { | 
            
        
          | 216 | 
                      name => 'type_of_record',  | 
          225 | 
                      name => 'type_of_record',  | 
        
        
          | 217 | 
                      type => 'string',  | 
          226 | 
                      type => 'string',  | 
        
        
          | 218 | 
                      facet => 0,  | 
          227 | 
                      facet => 0,  | 
        
  
    | 
      
            Lines 251-256
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 251 | 
           | 
          260 | 
           | 
        
        
          | 252 | 
              my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX }); | 
          261 | 
              my $see = Koha::SearchEngine::Elasticsearch::Search->new({ index => $Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX }); | 
        
        
          | 253 | 
           | 
          262 | 
           | 
        
            
               | 
               | 
              263 | 
                  my $callno = 'ABC123';  | 
            
            
              | 264 | 
                  my $callno2 = 'ABC456';  | 
            
            
              | 265 | 
                  my $long_callno = '1234567890' x 30;  | 
            
            
              | 266 | 
               | 
            
        
          | 254 | 
              my $marc_record_1 = MARC::Record->new();  | 
          267 | 
              my $marc_record_1 = MARC::Record->new();  | 
        
        
          | 255 | 
              $marc_record_1->leader('     cam  22      a 4500'); | 
          268 | 
              $marc_record_1->leader('     cam  22      a 4500'); | 
        
        
          | 256 | 
              $marc_record_1->append_fields(  | 
          269 | 
              $marc_record_1->append_fields(  | 
        
  
    | 
      
            Lines 262-269
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 262 | 
                  MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), | 
          275 | 
                  MARC::Field->new('245', '', '', a => 'Title:', b => 'first record'), | 
        
        
          | 263 | 
                  MARC::Field->new('999', '', '', c => '1234567'), | 
          276 | 
                  MARC::Field->new('999', '', '', c => '1234567'), | 
        
        
          | 264 | 
                  # '  ' for testing trimming of white space in boolean value callback:  | 
          277 | 
                  # '  ' for testing trimming of white space in boolean value callback:  | 
        
          
            
              | 265 | 
                      MARC::Field->new('952', '', '', 0 => '  ', g => '123.30'), | 
              278 | 
                      MARC::Field->new('952', '', '', 0 => '  ', g => '123.30', o => $callno), | 
            
            
              | 266 | 
                      MARC::Field->new('952', '', '', 0 => 0, g => '127.20'), | 
              279 | 
                      MARC::Field->new('952', '', '', 0 => 0, g => '127.20', o => $callno2), | 
            
            
               | 
               | 
              280 | 
                      MARC::Field->new('952', '', '', 0 => 1, g => '0.00', o => $long_callno), | 
            
        
          | 267 | 
              );  | 
          281 | 
              );  | 
        
        
          | 268 | 
              my $marc_record_2 = MARC::Record->new();  | 
          282 | 
              my $marc_record_2 = MARC::Record->new();  | 
        
        
          | 269 | 
              $marc_record_2->leader('     cam  22      a 4500'); | 
          283 | 
              $marc_record_2->leader('     cam  22      a 4500'); | 
        
  
    | 
      
            Lines 272-278
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 272 | 
                  # MARC::Field->new('210', '', '', a => 'Title 2'), | 
          286 | 
                  # MARC::Field->new('210', '', '', a => 'Title 2'), | 
        
        
          | 273 | 
                  # MARC::Field->new('245', '', '', a => 'Title: second record'), | 
          287 | 
                  # MARC::Field->new('245', '', '', a => 'Title: second record'), | 
        
        
          | 274 | 
                  MARC::Field->new('999', '', '', c => '1234568'), | 
          288 | 
                  MARC::Field->new('999', '', '', c => '1234568'), | 
        
          
            
              | 275 | 
                      MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric'), | 
              289 | 
                      MARC::Field->new('952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno), | 
            
        
          | 276 | 
              );  | 
          290 | 
              );  | 
        
        
          | 277 | 
              my $records = [$marc_record_1, $marc_record_2];  | 
          291 | 
              my $records = [$marc_record_1, $marc_record_2];  | 
        
        
          | 278 | 
           | 
          292 | 
           | 
        
  
    | 
      
            Lines 336-342
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 336 | 
              is(scalar @{$docs->[0][1]->{items_withdrawn_status}}, 2, 'First document items_withdrawn_status field should have two values'); | 
          350 | 
              is(scalar @{$docs->[0][1]->{items_withdrawn_status}}, 2, 'First document items_withdrawn_status field should have two values'); | 
        
        
          | 337 | 
              is_deeply(  | 
          351 | 
              is_deeply(  | 
        
        
          | 338 | 
                  $docs->[0][1]->{items_withdrawn_status}, | 
          352 | 
                  $docs->[0][1]->{items_withdrawn_status}, | 
        
          
            
              | 339 | 
                      ['false', 'false'],  | 
              353 | 
                      ['false', 'true'],  | 
            
        
          | 340 | 
                  'First document items_withdrawn_status field should be set correctly'  | 
          354 | 
                  'First document items_withdrawn_status field should be set correctly'  | 
        
        
          | 341 | 
              );  | 
          355 | 
              );  | 
        
        
          | 342 | 
           | 
          356 | 
           | 
        
  
    | 
      
            Lines 372-377
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 372 | 
              is(scalar @{$docs->[0][1]->{isbn}}, 4, 'First document isbn field should contain four values'); | 
          386 | 
              is(scalar @{$docs->[0][1]->{isbn}}, 4, 'First document isbn field should contain four values'); | 
        
        
          | 373 | 
              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'); | 
          387 | 
              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'); | 
        
        
          | 374 | 
           | 
          388 | 
           | 
        
            
               | 
               | 
              389 | 
                  is_deeply(  | 
            
            
              | 390 | 
                      $docs->[0][1]->{'local_classification'}, | 
            
            
              | 391 | 
                      [$callno, $callno2, $long_callno],  | 
            
            
              | 392 | 
                      'First document local_classification field should be set correctly'  | 
            
            
              | 393 | 
                  );  | 
            
            
              | 394 | 
               | 
            
        
          | 375 | 
              # Second record:  | 
          395 | 
              # Second record:  | 
        
        
          | 376 | 
           | 
          396 | 
           | 
        
        
          | 377 | 
              is(scalar @{$docs->[1][1]->{author}}, 1, 'Second document author field should contain one value'); | 
          397 | 
              is(scalar @{$docs->[1][1]->{author}}, 1, 'Second document author field should contain one value'); | 
        
  
    | 
      
            Lines 390-395
          subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
      
      
        Link Here
      
     | 
  
        
          | 390 | 
                  'Second document sum_item_price field should be set correctly'  | 
          410 | 
                  'Second document sum_item_price field should be set correctly'  | 
        
        
          | 391 | 
              );  | 
          411 | 
              );  | 
        
        
          | 392 | 
           | 
          412 | 
           | 
        
            
               | 
               | 
              413 | 
                  is_deeply(  | 
            
            
              | 414 | 
                      $docs->[1][1]->{local_classification__sort}, | 
            
            
              | 415 | 
                      [substr($long_callno, 0, 255)],  | 
            
            
              | 416 | 
                      'Second document local_classification__sort field should be set correctly'  | 
            
            
              | 417 | 
                  );  | 
            
            
              | 418 | 
               | 
            
        
          | 393 | 
              # Mappings marc_type:  | 
          419 | 
              # Mappings marc_type:  | 
        
        
          | 394 | 
           | 
          420 | 
           | 
        
        
          | 395 | 
              ok(!(defined $docs->[0][1]->{unimarc_title}), "No mapping when marc_type doesn't match marc flavour"); | 
          421 | 
              ok(!(defined $docs->[0][1]->{unimarc_title}), "No mapping when marc_type doesn't match marc flavour"); | 
        
            
              | 396 | 
              -   | 
               | 
               |