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

(-)a/cataloguing/value_builder/unimarc_field_4XX.pl (-5 / +8 lines)
Lines 34-39 use Koha::ItemTypes; Link Here
34
34
35
use Koha::SearchEngine;
35
use Koha::SearchEngine;
36
use Koha::SearchEngine::Search;
36
use Koha::SearchEngine::Search;
37
use Koha::SearchEngine::QueryBuilder;
37
38
38
sub plugin_parameters {
39
sub plugin_parameters {
39
    my ( $dbh, $record, $tagslib, $i ) = @_;
40
    my ( $dbh, $record, $tagslib, $i ) = @_;
Lines 337-346 sub plugin { Link Here
337
        my $startfrom      = $query->param('startfrom');
338
        my $startfrom      = $query->param('startfrom');
338
        my $resultsperpage = $query->param('resultsperpage') || 20;
339
        my $resultsperpage = $query->param('resultsperpage') || 20;
339
        my $orderby;
340
        my $orderby;
340
        my $op = 'and';
341
        my $limits = $itype ? ["mc-itype,phr:$itype"] : [];
341
        $search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype;
342
343
        my $builder  = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
342
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
344
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
343
        my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($search, $startfrom * $resultsperpage, $resultsperpage );
345
346
        my ($builderror, $es_query)= $builder->build_query_compat( undef, [$search], ['kw'], $limits, ['relevance']);
347
        my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($es_query, $startfrom * $resultsperpage, $resultsperpage );
344
        if (defined $errors ) {
348
        if (defined $errors ) {
345
            $results = [];
349
            $results = [];
346
        }
350
        }
Lines 437-443 sub plugin { Link Here
437
        if ( $total_hits < $from + $resultsperpage ) {
441
        if ( $total_hits < $from + $resultsperpage ) {
438
            $to = $total_hits;
442
            $to = $total_hits;
439
        }else{
443
        }else{
440
            $to = $from + $resultsperpage ;
444
            $to = $startfrom * $resultsperpage + $resultsperpage ;
441
        }
445
        }
442
        my $defaultview =
446
        my $defaultview =
443
          'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView');
447
          'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView');
444
- 

Return to bug 26537