Bug 22801: (follow-up) Use date-of-publication directly
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
7ab5837808
commit
d1c7333fbf
|
|
@ -995,9 +995,6 @@ The argument should be an arrayref, and it'll return an arrayref.
|
|||
sub _fix_limit_special_cases {
|
||||
my ( $self, $limits ) = @_;
|
||||
|
||||
# yr is usually an alias of a search field
|
||||
my $yrfield = ( exists $index_field_convert{'yr'} ) ? $index_field_convert{'yr'} : 'yr';
|
||||
|
||||
my @new_lim;
|
||||
foreach my $l (@$limits) {
|
||||
|
||||
|
|
@ -1006,13 +1003,13 @@ sub _fix_limit_special_cases {
|
|||
my ( $start, $end ) =
|
||||
( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
|
||||
next unless defined($start) && defined($end);
|
||||
push @new_lim, "$yrfield:[$start TO $end]";
|
||||
push @new_lim, "date-of-publication:[$start TO $end]";
|
||||
}
|
||||
elsif ( $l =~ /^yr,st-numeric=/ ) {
|
||||
my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ );
|
||||
next unless defined($date);
|
||||
$date = $self->_modify_string_by_type(type => 'st-year', operand => $date);
|
||||
push @new_lim, "$yrfield:$date";
|
||||
push @new_lim, "date-of-publication:$date";
|
||||
}
|
||||
elsif ( $l =~ /^available$/ ) {
|
||||
push @new_lim, 'onloan:false';
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ subtest 'build_query tests' => sub {
|
|||
( undef, $query ) = $qb->build_query_compat( undef, ['2019-'], ['yr,st-year'], ['yr,st-numeric=-2019'] );
|
||||
is(
|
||||
$query->{query}{query_string}{query},
|
||||
'(date-of-publication:[2019 TO *]) AND copydate:[* TO 2019]',
|
||||
'(date-of-publication:[2019 TO *]) AND date-of-publication:[* TO 2019]',
|
||||
'Open end year in year range of an st-year search is handled properly'
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue