From 3399e3d4b8429393aefd9552ef8c74388f073b6b Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 17 Nov 2015 13:03:59 +1100 Subject: [PATCH] Bug 15198: Make OpacSuppression work even if there are no records suppressed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds the Zebra special attribute 14 to ccl.properties and opac-search.pl, so that we can turn on OpacSuppression and still return results even if there are no records in Zebra for the Suppress index. _TEST PLAN_ Before applying: 1) Make sure that you have no suppressed records indexed in Zebra 2) Turn on OpacSuppression system preference 3) Search using a keyword which should bring up records 4) Note that no records are returned in the results 5) Change UseQueryParser system preference to "Try" 6) Repeat steps 3-4 Apply the patch. After applying: 7) Repeat step 3 (ie search using a keyword which should bring up records) 8) Confirm that records are appearing in the results! 9) Change UseQueryParser system preference to "Do not try" 10) Repeat step 3 11) Confirm that records are appearing in the results! Signed-off-by: Hector Castro Works as advertised. No more, won't need to have at least one record with the value "1" in the field mapped with this index. All records in OPAC returned. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit dd9a4ed6c6fbc078d43880e4adf8cfe28179888d) Signed-off-by: Frédéric Demians (cherry picked from commit c0928321a062fed31ce4ca841237be36d3e14cc2) Signed-off-by: Liz Rea --- etc/zebradb/ccl.properties | 2 +- opac/opac-search.pl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties index c2d8fd83d7..986d0d52f2 100644 --- a/etc/zebradb/ccl.properties +++ b/etc/zebradb/ccl.properties @@ -974,7 +974,7 @@ cn-class 1=9007 cn-item 1=9008 cn-prefix 1=9009 cn-suffix 1=9010 -Suppress 1=9011 +Suppress 1=9011 14=1 id-other 1=9012 date-entered-on-file 1=date-entered-on-file extent 1=Extent diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 1989a96307..606589a087 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -505,7 +505,7 @@ if (C4::Context->preference('OpacSuppression')) { my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); if ($IPAddress !~ /^$IPRange/) { if ( $query_type eq 'pqf' ) { - $query = '@not '.$query.' @attr 1=9011 1'; + $query = '@not '.$query.' @attr 14=1 @attr 1=9011 1'; } else { $query = "($query) not Suppress=1"; } @@ -514,7 +514,7 @@ if (C4::Context->preference('OpacSuppression')) { else { if ( $query_type eq 'pqf' ) { #$query = "($query) && -(suppress:1)"; #QP syntax - $query = '@not '.$query.' @attr 1=9011 1'; #PQF syntax + $query = '@not '.$query.' @attr 14=1 @attr 1=9011 1'; #PQF syntax } else { $query = "($query) not Suppress=1"; } -- 2.39.5