From 41b4374bd6010e7d2b4c6691467656333dee7cf8 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 185d715e5a..0704f1f8f8 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1235,10 +1235,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.32.0