Bugzilla – Attachment 26283 Details for
Bug 10542
QueryParser + OpacSuppression doesn't allow search in 'all libraries'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10542: Fix QueryParser with OpacSupression
Bug-10542-Fix-QueryParser-with-OpacSupression.patch (text/plain), 2.87 KB, created by
Martin Renvoize (ashimema)
on 2014-03-13 14:00:40 UTC
(
hide
)
Description:
Bug 10542: Fix QueryParser with OpacSupression
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2014-03-13 14:00:40 UTC
Size:
2.87 KB
patch
obsolete
>From f84da3bc220bf190d21ee324f0ae2c001e4c2f53 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 12 Mar 2014 17:43:20 +0000 >Subject: [PATCH] Bug 10542: Fix QueryParser with OpacSupression > >OpacSupressions manipulates the query string after the buildQuery >call and so breaks with queryParser enabled. This patch adds >checks for queryParser and manipulates the query before passing it >to buildQuery if it is enabled, but leaves the post buildQuery >manipultation when queryParser is disabled >--- > opac/opac-search.pl | 37 ++++++++++++++++++++++++++++--------- > 1 file changed, 28 insertions(+), 9 deletions(-) > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 617d67e..27531bd 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -445,6 +445,23 @@ my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_ > > my @results; > >+# Add OPAC suppression - requires at least one item indexed with Suppress >+if (C4::Context->preference('UseQueryParser')) { >+ if (C4::Context->preference('OpacSuppression')) { >+ # OPAC suppression by IP address >+ if (C4::Context->preference('OpacSuppressionByIPRange')) { >+ my $IPAddress = $ENV{'REMOTE_ADDR'}; >+ my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); >+ if ($IPAddress !~ /^$IPRange/) { >+ $query = "$query -suppress:1"; >+ } >+ } >+ else { >+ $query = "$query -suppress:1"; >+ } >+ } >+} >+ > ## I. BUILD THE QUERY > ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by, 0, $lang); > >@@ -472,18 +489,20 @@ my @limit_inputs = $limit_cgi ? _input_cgi_parse($limit_cgi) : (); > #} > # > # add OPAC suppression - requires at least one item indexed with Suppress >-if (C4::Context->preference('OpacSuppression')) { >- # OPAC suppression by IP address >- if (C4::Context->preference('OpacSuppressionByIPRange')) { >- my $IPAddress = $ENV{'REMOTE_ADDR'}; >- my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); >- if ($IPAddress !~ /^$IPRange/) { >+unless ( C4::Context->preference('UseQueryParser') ) { >+ if (C4::Context->preference('OpacSuppression')) { >+ # OPAC suppression by IP address >+ if (C4::Context->preference('OpacSuppressionByIPRange')) { >+ my $IPAddress = $ENV{'REMOTE_ADDR'}; >+ my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); >+ if ($IPAddress !~ /^$IPRange/) { >+ $query = "($query) not Suppress=1"; >+ } >+ } >+ else { > $query = "($query) not Suppress=1"; > } > } >- else { >- $query = "($query) not Suppress=1"; >- } > } > > $template->param ( LIMIT_INPUTS => \@limit_inputs ); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10542
:
26208
|
26251
|
26283
|
26311
|
29909
|
29910
|
29942
|
29944
|
30478
|
30479
|
30660
|
30661