From 01e8c21439afa8b28735b03037839da9dd723639 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Wed, 22 May 2024 21:08:35 +0000 Subject: [PATCH] Bug 36930: Item search gives irrelevant results when using 2+ added filter criteria MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In the Item search the librarian is allowed, in the first step, to define additional filters like Title, Author, Publisher, Publication date etc. (in the third fieldset). This works fine but only for one criterion. If one adds two or more criteria, the filter does not apply at all. Test plan ========= 1. Make an Item search with the Pulblisher filter. Put %University of California% as the value. You should get 5 rows (with standard ktd test data set), three from 1982, and two from 1988. 2. Edit search -> add the second criterion: AND Publication date is 1982. You would expect three rows but you get 900+ rows. 3. Apply the patch; restart_all. 4. Repeat p. 2. You should get the expected three rows. Signed-off-by: Pedro Amorim Signed-off-by: Martin Renvoize (cherry picked from commit bdc7ac2c93f9af9ac196c77da47758a1078c47d7) Signed-off-by: Lucas Gass (cherry picked from commit dca760d5b24428143a0e0de7b52c131c813488fc) Signed-off-by: Fridolin Somers Signed-off-by: wainuiwitikapark (cherry picked from commit fc8c2ac8c1c8cf01d43d7b7363cb53237bd361bf) Signed-off-by: Frédéric Demians --- catalogue/itemsearch.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index a16f033bc4..23f026e9c8 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -135,10 +135,11 @@ if ( defined $format ) { } } - my @c = $cgi->multi_param('c'); - my @fields = $cgi->multi_param('f'); - my @q = $cgi->multi_param('q'); - my @op = $cgi->multi_param('op'); + my %param_names = map { $_ => 1 } $cgi->multi_param; + my @c = $param_names{'c[]'} ? $cgi->multi_param('c[]') : $cgi->multi_param('c'); + my @fields = $param_names{'f[]'} ? $cgi->multi_param('f[]') : $cgi->multi_param('f'); + my @q = $param_names{'q[]'} ? $cgi->multi_param('q[]') : $cgi->multi_param('q'); + my @op = $param_names{'op[]'} ? $cgi->multi_param('op[]') : $cgi->multi_param('op'); my $f; for (my $i = 0; $i < @fields; $i++) { -- 2.39.5