From 49cfaabebbb2505c15c14e40aea7ebb6dc5225d3 Mon Sep 17 00:00:00 2001
From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Fri, 14 Jan 2011 02:49:33 +0000
Subject: [PATCH] Enable truncation attribute in Z39.50 queries to be left out
 entirely

Per https://bugs.launchpad.net/evergreen/+bug/702695, some Z39.50
servers hate the truncation attribute (@attr 5=anything) and always
return 0 hits.

This gives you the ability to specify a negative value for the
truncation attribute and thereby prevent the truncation attribute
from being included in the Z39.50 query for a given server.


git-svn-id: svn://svn.open-ils.org/ILS/trunk@19175 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
index 27362a9c02..ddc6b78d2a 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Z3950.pm
@@ -447,7 +447,8 @@ sub compile_query {
 		next unless ( exists $services{$service}->{attrs}->{$_} );
 		$str .= '@attr 1=' . $services{$service}->{attrs}->{$_}->{code} . # add the use attribute
 			' @attr 4=' . $services{$service}->{attrs}->{$_}->{format}; # add the structure attribute
-		if (exists $services{$service}->{attrs}->{$_}->{truncation}){
+		if (exists $services{$service}->{attrs}->{$_}->{truncation}
+                &&  $services{$service}->{attrs}->{$_}->{truncation} >= 0) {
 			$str .= ' @attr 5=' . $services{$service}->{attrs}->{$_}->{truncation};
 		}
 		$str .= " \"" . $$hash{$_} . "\" "; # add the search term
-- 
2.11.0