From 47069f3c70d0875b7be3efbca40dbaf64aa00ec4 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Thu, 29 Mar 2018 12:00:14 +0200 Subject: [PATCH] Bug 20492: Add missing case for advanced search year limit Add missing case for when using "year" limit in advanced search, which results the zebra limit "yr,st-numeric=YYYY-YYYY". This will now be convered to an ElasticSearch range. How to test: 1) Perform a year limit search by choosing "More options" in advanced search page and enter a year range that should produce results. 2) This should not produce the expected results. 3) Apply patch 4) Perform the same search again, it should now produce the expected results. Sponsored-by: Gothenburg University Library --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 95cc86ab78..a1bf519e54 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -751,6 +751,11 @@ sub _fix_limit_special_cases { next unless defined($start) && defined($end); push @new_lim, "copydate:[$start TO $end]"; } + elsif ( $l =~ /^yr,st-numeric=(\d*|[*])-(\d*|[*])$/ ) { + my $start = $1 || '*'; + my $end = $2 || '*'; + push @new_lim, "copydate:[$start TO $end]"; + } elsif ( $l =~ /^yr,st-numeric=/ ) { my ($date) = ( $l =~ /^yr,st-numeric=(.*)$/ ); next unless defined($date); -- 2.11.0