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

(-)a/labels/label-item-search.pl (-12 / +20 lines)
Lines 58-86 my $display_columns = [ {_add => {label => "Add Item", link_fi Link Here
58
if ( $op eq "do_search" ) {
58
if ( $op eq "do_search" ) {
59
    $idx         = $query->param('idx');
59
    $idx         = $query->param('idx');
60
    $ccl_textbox = $query->param('ccl_textbox');
60
    $ccl_textbox = $query->param('ccl_textbox');
61
    if ( $ccl_textbox && $idx ) {
62
        $ccl_query = "$idx:$ccl_textbox";
63
    }
64
61
65
    $datefrom = $query->param('datefrom');
62
    $datefrom = $query->param('datefrom');
66
    $dateto   = $query->param('dateto');
63
    $dateto   = $query->param('dateto');
67
64
65
    my $builder = Koha::SearchEngine::QueryBuilder->new(
66
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
67
    my $searcher = Koha::SearchEngine::Search->new(
68
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
69
70
    my @limits;
68
    if ($datefrom) {
71
    if ($datefrom) {
69
        $ccl_query .= ' AND ' if $ccl_textbox;
72
        push(@limits, "acqdate,ge,st-date-normalized=$datefrom");
70
        $ccl_query .= "acqdate,ge,st-date-normalized=" . $datefrom;
71
    }
73
    }
72
74
73
    if ($dateto) {
75
    if ($dateto) {
74
        $ccl_query .= ' AND ' if ( $ccl_textbox || $datefrom );
76
        push(@limits, "acqdate,le,st-date-normalized=$dateto");
75
        $ccl_query .= "acqdate,le,st-date-normalized=" . $dateto;
76
    }
77
    }
77
78
79
    my ( $error, $query, $simple_query, $query_cgi,
80
        $query_desc, $limit, $limit_cgi, $limit_desc,
81
        $query_type )
82
        = $builder->build_query_compat( undef, [$ccl_textbox], [$idx], \@limits);
83
78
    my $offset = $startfrom > 1 ? $startfrom - 1 : 0;
84
    my $offset = $startfrom > 1 ? $startfrom - 1 : 0;
79
    my $searcher = Koha::SearchEngine::Search->new({index => 'biblios'});
80
    ( $error, $marcresults, $total_hits ) = $searcher->simple_search_compat($ccl_query, $offset, $resultsperpage);
81
85
82
    if (!defined $error && @{$marcresults} ) {
86
    my ( $error, $marcresults, $facets ) = $searcher->search_compat(
83
        $show_results = @{$marcresults};
87
        $query, $simple_query, undef, ['biblioserver'], $resultsperpage, $offset,
88
        undef, undef, $query_type, undef
89
   );
90
91
    if (!defined $error && $marcresults->{biblioserver}{RECORDS} ) {
92
        $show_results = $marcresults->{biblioserver}{RECORDS};
84
    }
93
    }
85
    else {
94
    else {
86
        Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat");
95
        Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat");
87
- 

Return to bug 30745