Bug 4852 - rewrite the query to include limits if using ccl=
authorRobin Sheat <robin@catalyst.net.nz>
Thu, 24 Feb 2011 21:33:38 +0000 (16:33 -0500)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 3 Mar 2011 23:58:52 +0000 (12:58 +1300)
Signed-off-by: Jared Camins-Esakov <jcamins@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Search.pm

index a469948..45ebb24 100644 (file)
@@ -1043,7 +1043,13 @@ sub buildQuery {
 # for handling ccl, cql, pqf queries in diagnostic mode, skip the rest of the steps
 # DIAGNOSTIC ONLY!!
     if ( $query =~ /^ccl=/ ) {
-        return ( undef, $', $', "q=ccl=$'", $', '', '', '', '', 'ccl' );
+        my $q=$';
+        # This is needed otherwise ccl= and &limit won't work together, and
+        # this happens when selecting a subject on the opac-detail page
+        if (@limits) {
+            $q .= ' and '.join(' and ', @limits);
+        }
+        return ( undef, $q, $q, "q=ccl=$q", $q, '', '', '', '', 'ccl' );
     }
     if ( $query =~ /^cql=/ ) {
         return ( undef, $', $', "q=cql=$'", $', '', '', '', '', 'cql' );