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

(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-2 / +35 lines)
Lines 548-557 subtest 'build query from form subtests' => sub { Link Here
548
};
548
};
549
549
550
subtest 'build_query with weighted fields tests' => sub {
550
subtest 'build_query with weighted fields tests' => sub {
551
    plan tests => 4;
551
    plan tests => 6;
552
552
553
    $se->mock( '_load_elasticsearch_mappings', sub {
553
    $se->mock( '_load_elasticsearch_mappings', sub {
554
        return {
554
        return {
555
            authorities => {
556
                heading => {
557
                    label => 'heading',
558
                    type => 'string',
559
                    opac => 0,
560
                    staff_client => 1,
561
                    mappings => [{
562
                        marc_field => '150',
563
                        marc_type => 'marc21',
564
                    }]
565
                },
566
                headingmain => {
567
                    label => 'headingmain',
568
                    type => 'string',
569
                    opac => 1,
570
                    staff_client => 1,
571
                    mappings => [{
572
                        marc_field => '150',
573
                        marc_type => 'marc21',
574
                    }]
575
                }
576
            },
555
            biblios => {
577
            biblios => {
556
                abstract => {
578
                abstract => {
557
                    label => 'abstract',
579
                    label => 'abstract',
Lines 636-641 subtest 'build_query with weighted fields tests' => sub { Link Here
636
        ['abstract'],
658
        ['abstract'],
637
        'Only OPAC search fields are used when opac search is performed'
659
        'Only OPAC search fields are used when opac search is performed'
638
    );
660
    );
661
662
    $qb = Koha::SearchEngine::Elasticsearch::QueryBuilder->new( { index => 'authorities' } );
663
    ( undef, $query ) = $qb->build_query_compat( undef, ['title:"donald duck"'], undef, undef,
664
    undef, undef, undef, { weighted_fields => 1 });
665
    $fields = $query->{query}{query_string}{fields};
666
    is_deeply( [sort @$fields], ['heading','headingmain'],'Authorities fields retrieve for authorities index');
667
668
    ( undef, $query ) = $qb->build_query_compat( undef, ['title:"donald duck"'], undef, undef,
669
    undef, undef, undef, { weighted_fields => 1, is_opac => 1 });
670
    $fields = $query->{query}{query_string}{fields};
671
    is_deeply($fields,['headingmain'],'Only opac authorities fields retrieved for authorities index is is_opac');
672
639
};
673
};
640
674
641
subtest "_convert_sort_fields() tests" => sub {
675
subtest "_convert_sort_fields() tests" => sub {
642
- 

Return to bug 25278