From 6768c2874bcb11fc8cf7e155e7686ea7eaa8858d Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 22 Jul 2014 09:26:03 +1000 Subject: [PATCH] Bug 10542: QueryParser + OpacSuppression doesn't allow search in 'all libraries' Since we're using the $query_type variable to detect if this pre-built query is PQF, we need to use PQF syntax (rather than QueryParser syntax) when adding to the query. I've made a lot of notes of somewhat incoherent notes on Bugzilla talking about PQF, CCL, and QP syntaxes, but I'm hoping to refine these notes on a wiki page for future reference. _TEST PLAN_ 1) Set 'Suppress in Opac' (ie 942$n) to 1 for one record 2) Re-index Zebra 3) Set 'OpacSuppression' to 'Hide' 4) Set 'UseQueryParser' to 'Do not try' 5) In the staff client, do a search that will return that suppressed record as well as a few records that are NOT suppressed 6) Note that you can return that suppressed record in the staff client 7) Do the same search in the OPAC 8) Note that the suppressed record doesn't appear 9) Set 'UseQueryParser' to 'Try' && re-run the OPAC search 10) Note that no results appear (the logs will probably mention a ZOOM error) 11) Apply patch 12) Re-run the OPAC search 13) Note that the suppressed record doesn't appear, and that the not suppressed records are showing (it's important that you are getting some results...as ZOOM errors are silent in the UI). 14) Set 'UseQueryParser' to 'Do not try' 15) Re-run the search 16) Note that the suppressed record doesn't appear, and that the not suppressed records are showing Signed-off-by: Bernardo Gonzalez Kriegel Work as described following test plan. No koha-qa errors. Signed-off-by: Katrin Fischer Works as described - hidden records are hidden. Passes tests and QA script. Signed-off-by: Tomas Cohen Arazi --- opac/opac-search.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 7edaf6d236..cac6ab5ab9 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -482,7 +482,7 @@ if (C4::Context->preference('OpacSuppression')) { my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); if ($IPAddress !~ /^$IPRange/) { if ( $query_type eq 'pqf' ) { - $query = "($query) && -(suppress:1)"; + $query = '@not '.$query.' @attr 1=9011 1'; } else { $query = "($query) not Suppress=1"; } @@ -490,7 +490,8 @@ if (C4::Context->preference('OpacSuppression')) { } else { if ( $query_type eq 'pqf' ) { - $query = "($query) && -(suppress:1)"; + #$query = "($query) && -(suppress:1)"; #QP syntax + $query = '@not '.$query.' @attr 1=9011 1'; #PQF syntax } else { $query = "($query) not Suppress=1"; } -- 2.39.5