View | Details | Raw Unified | Return to bug 24720
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch.pm (-2 / +3 lines)
Lines 890-897 sub marc_records_to_documents { Link Here
890
890
891
                    # Make sure to keep the sort field length sensible. 255 was chosen as a nice round value.
891
                    # Make sure to keep the sort field length sensible. 255 was chosen as a nice round value.
892
                    $record_document->{$field} = [ substr( join( ' ', @{ $record_document->{$field} } ), 0, 255 ) ];
892
                    $record_document->{$field} = [ substr( join( ' ', @{ $record_document->{$field} } ), 0, 255 ) ];
893
                    # Strip any initial non-word characters which don't make much sense to sort on
893
                    # Strip any initial non-word characters which don't make much sense to sort on,
894
                    $record_document->{$field} = [ map { s/^\W+//u; $_ } @{$record_document->{$field}} ];
894
                    # leave as is if contains nothing but non-word characters
895
                    $record_document->{$field} = [ map { s/^\W+(?=\w)//u; $_ } @{$record_document->{$field}} ];
895
                }
896
                }
896
            }
897
            }
897
        }
898
        }
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch.t (-2 / +8 lines)
Lines 211-217 subtest 'get_elasticsearch_mappings() tests' => sub { Link Here
211
211
212
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
212
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
213
213
214
    plan tests => 71;
214
    plan tests => 72;
215
215
216
    t::lib::Mocks::mock_preference( 'marcflavour',             'MARC21' );
216
    t::lib::Mocks::mock_preference( 'marcflavour',             'MARC21' );
217
    t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', 'base64ISO2709' );
217
    t::lib::Mocks::mock_preference( 'ElasticsearchMARCFormat', 'base64ISO2709' );
Lines 500-505 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
500
500
501
        # MARC::Field->new('210', '', '', a => 'Title 2'),
501
        # MARC::Field->new('210', '', '', a => 'Title 2'),
502
        # MARC::Field->new('245', '', '', a => 'Title: second record'),
502
        # MARC::Field->new('245', '', '', a => 'Title: second record'),
503
        MARC::Field->new( '246', '', '', a => '!!!' ),
503
        MARC::Field->new( '260', '', '', a => 'New York :', b => 'Ace ,', c => '1963-2003' ),
504
        MARC::Field->new( '260', '', '', a => 'New York :', b => 'Ace ,', c => '1963-2003' ),
504
        MARC::Field->new( '999', '', '', c => '1234568' ),
505
        MARC::Field->new( '999', '', '', c => '1234568' ),
505
        MARC::Field->new( '952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno ),
506
        MARC::Field->new( '952', '', '', 0 => 1, g => 'string where should be numeric', o => $long_callno ),
Lines 714-719 subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' Link Here
714
715
715
    # Second record:
716
    # Second record:
716
717
718
    is(
719
        $docs->[1]->{title_sort__sort}[0],
720
        '!!!',
721
        'Second document title_sort should have been left as is as only contains non word characters',
722
    );
723
717
    is_deeply( $docs->[1]->{author}, ['Author 2'], 'Second document author field should be set correctly' );
724
    is_deeply( $docs->[1]->{author}, ['Author 2'], 'Second document author field should be set correctly' );
718
725
719
    is(
726
    is(
720
- 

Return to bug 24720