From 1b2f9717dc7652727ed8d4a7487a6ce170735f5a Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 6 Nov 2020 10:10:14 +0100 Subject: [PATCH] Bug 26860: (follow-up) case requesting zebra with ccl query When calling a ccl syntax query, code must be added like for availability facet. See Bug 17278: Use available limit when requesting zebra when ccl query is used This patch also changes "grep {!/^available$/} @limits" to use "grep { $_ ne 'available' } @limits". Following the logic of : Bug 23084: Replace grep {^$var$} with grep {$_ eq $var} Test plan : 1) Use Zebra search engine 2) Perform a search on staff interface with explicit index, for example 'ti:history' 3) This search must return some records with and some without items 4) Click on 'Limit to records without items' 5) Check you see only records without items 6) Click on 'Show all records' 7) Check you see all records again 8) Check availability facet is also working Signed-off-by: David Nind --- C4/Search.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index 632376d6e1..a8d757b27c 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1234,10 +1234,18 @@ sub buildQuery { $q =~ s| and \( \(allrecords,AlwaysMatches=''\) and \(not-onloan-count,st-numeric >= 1\) and \(lost,st-numeric=0\) \)||; $original_q = $q; } + unless ( grep { $_ eq 'withoutitems' } @limits ) { + $q =~ s| and \( allrecords,AlwaysMatches='' not\(homebranch,AlwaysMatches=''\) \)||; + $original_q = $q; + } if ( @limits ) { if ( grep { $_ eq 'available' } @limits ) { $q .= q| and ( (allrecords,AlwaysMatches='') and (not-onloan-count,st-numeric >= 1) and (lost,st-numeric=0) )|; - @limits = grep {!/^available$/} @limits; + @limits = grep { $_ ne 'available' } @limits; + } + if ( grep { $_ eq 'withoutitems' } @limits ) { + $q .= q| and ( allrecords,AlwaysMatches='' not(homebranch,AlwaysMatches='') )|; + @limits = grep { $_ ne 'withoutitems' } @limits; } $q .= ' and '.join(' and ', @limits) if @limits; } -- 2.11.0