From 7ba226332e25b40b1b22d09a2293f5ccecc9fbfa 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 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 --- catalogue/itemsearch.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 975b96a70b..8cb69c2d85 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -144,10 +144,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.2