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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (+17 lines)
Lines 1052-1057 sub _fix_limit_special_cases { Link Here
1052
    my ( $self, $limits ) = @_;
1052
    my ( $self, $limits ) = @_;
1053
1053
1054
    my @new_lim;
1054
    my @new_lim;
1055
    my $ranges;
1055
    foreach my $l (@$limits) {
1056
    foreach my $l (@$limits) {
1056
1057
1057
        # This is set up by opac-search.pl
1058
        # This is set up by opac-search.pl
Lines 1096-1101 sub _fix_limit_special_cases { Link Here
1096
        elsif ( $l =~ /^available$/ ) {
1097
        elsif ( $l =~ /^available$/ ) {
1097
            push @new_lim, 'onloan:false';
1098
            push @new_lim, 'onloan:false';
1098
        }
1099
        }
1100
        elsif ($l =~ /^acqdate,(ge|le),st-date-normalized=/ ) {
1101
            my ($fromdate) = ( $l =~ /^acqdate,ge,st-date-normalized=(.*)$/ );
1102
            my ($todate) = ( $l =~ /^acqdate,le,st-date-normalized=(.*)$/ );
1103
            $fromdate ||= '*';
1104
            $todate ||= '*';
1105
            $ranges->{'date-of-acquisition.raw'} = {
1106
                from => $fromdate,
1107
                to => $todate
1108
            }
1109
        }
1099
        else {
1110
        else {
1100
            my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
1111
            my ( $field, $term ) = $l =~ /^\s*([\w,-]*?):(.*)/;
1101
            $field =~ s/,phr$//; #We are quoting all the limits as phrase, this prevents from quoting again later
1112
            $field =~ s/,phr$//; #We are quoting all the limits as phrase, this prevents from quoting again later
Lines 1106-1111 sub _fix_limit_special_cases { Link Here
1106
                push @new_lim, $l;
1117
                push @new_lim, $l;
1107
            }
1118
            }
1108
        }
1119
        }
1120
1121
        if ( $ranges ) {
1122
            foreach my $index ( keys %$ranges ) {
1123
                push @new_lim, "$index:[$ranges->{$index}{from} TO $ranges->{$index}{to}]"
1124
            }
1125
        }
1109
    }
1126
    }
1110
    return \@new_lim;
1127
    return \@new_lim;
1111
}
1128
}
(-)a/labels/label-item-search.pl (-7 / +8 lines)
Lines 33-38 use Koha::Logger; Link Here
33
use Koha::DateUtils qw( dt_from_string output_pref );
33
use Koha::DateUtils qw( dt_from_string output_pref );
34
use Koha::Items;
34
use Koha::Items;
35
use Koha::ItemTypes;
35
use Koha::ItemTypes;
36
use Koha::SearchEngine::QueryBuilder;
36
use Koha::SearchEngine::Search;
37
use Koha::SearchEngine::Search;
37
38
38
my $query = CGI->new;
39
my $query = CGI->new;
Lines 85-104 if ( $op eq "do_search" ) { Link Here
85
        }
86
        }
86
    }
87
    }
87
88
88
    my ( $error, $query, $simple_query, $query_cgi,
89
    my ( $build_error, $query, $simple_query, $query_cgi,
89
        $query_desc, $limit, $limit_cgi, $limit_desc,
90
        $query_desc, $limit, $limit_cgi, $limit_desc,
90
        $query_type )
91
        $query_type )
91
        = $builder->build_query_compat( undef, [$ccl_textbox], [$idx], \@limits);
92
        = $builder->build_query_compat( undef, [$ccl_textbox], [$idx], \@limits);
92
93
93
    my $offset = $startfrom > 1 ? $startfrom - 1 : 0;
94
    my $offset = $startfrom > 1 ? $startfrom - 1 : 0;
94
95
95
    my ( $error, $marcresults, $facets ) = $searcher->search_compat(
96
    my ( $error, $results, $facets ) = $searcher->search_compat(
96
        $query, $simple_query, undef, ['biblioserver'], $resultsperpage, $offset,
97
        $query, $simple_query, [], ['biblioserver'], $resultsperpage, $offset,
97
        undef, undef, $query_type, undef
98
        undef, undef, $query_type, undef
98
   );
99
    );
99
100
100
    if (!defined $error && $marcresults->{biblioserver}{RECORDS} ) {
101
    if (!defined $error && @{$results->{biblioserver}{RECORDS}} ) {
101
        $show_results = $marcresults->{biblioserver}{RECORDS};
102
        $show_results = @{$results->{biblioserver}{RECORDS}};
103
        $marcresults = $results->{biblioserver}{RECORDS};
102
    }
104
    }
103
    else {
105
    else {
104
        Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat");
106
        Koha::Logger->get->warn("ERROR label-item-search: no results from simple_search_compat");
105
- 

Return to bug 30745