Enable truncation attribute in Z39.50 queries to be left out entirely
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 14 Jan 2011 02:49:33 +0000 (02:49 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 14 Jan 2011 02:49:33 +0000 (02:49 +0000)
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

index 27362a9..ddc6b78 100644 (file)
@@ -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