From: Adam Dickmeiss Date: Tue, 14 Nov 1995 09:53:16 +0000 (+0000) Subject: New boolean target config: target support elementSetNames? X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=5bbe4c302d2d105aea7806317e9f31d5773a9536;p=egate.git New boolean target config: target support elementSetNames? --- diff --git a/www/z39util.tcl b/www/z39util.tcl index 476673b..23fabd6 100644 --- a/www/z39util.tcl +++ b/www/z39util.tcl @@ -1,5 +1,5 @@ # -# $Id: z39util.tcl,v 1.9 1995/11/13 18:17:48 adam Exp $ +# $Id: z39util.tcl,v 1.10 1995/11/14 09:53:16 adam Exp $ # proc saveState {} { uplevel #0 { @@ -26,12 +26,12 @@ proc saveState {} { } } -proc search-response {sno} { +proc search-response {zz} { global sessionWait - set status [z39.$sno responseStatus] + set status [$zz responseStatus] if {[lindex $status 0] == "NSD"} { - z39.$sno nextResultSetPosition 0 + $zz nextResultSetPosition 0 set code [lindex $status 1] set msg [lindex $status 2] set addinfo [lindex $status 3] @@ -364,13 +364,13 @@ proc build-query {t} { } switch $op { And - { set q "@and $q ${attr} \{${term}\}" } + { set q "@and $q ${attr} ${term}" } Or - { set q "@or $q ${attr} \{${term}\}" } + { set q "@or $q ${attr} ${term}" } {And not} - { set q "@not $q ${attr} \{${term}\}" } + { set q "@not $q ${attr} ${term}" } {} - { set q "${attr} \{${term}\}" } + { set q "${attr} ${term}" } } set op [wform logic$i] } @@ -381,6 +381,7 @@ proc build-query {t} { proc z39search {setNo piggy tno elements} { global hist global sessionWait + global targets if {$tno > 0} { set zz z39$tno @@ -439,19 +440,25 @@ proc z39search {setNo piggy tno elements} { displayError "Cannot initialize target $host" $u return 0 } - } - if {![catch [list $zz.$setNo smallSetUpperBound 0]]} { - return 1 + } else { + if {![catch [list $zz.$setNo smallSetUpperBound 0]]} { + return 1 + } } ir-set $zz.$setNo $zz + + if {![lindex $targets($host) 5]} { + set elements {} + } $zz.$setNo smallSetElementSetNames $elements $zz.$setNo mediumSetElementSetNames $elements $zz.$setNo recordElements $elements + eval $zz.$setNo databaseNames $database $zz.$setNo preferredRecordSyntax USMARC - $zz callback search-response $setNo + $zz callback [list search-response $zz.$setNo] if {$piggy} { $zz.$setNo largeSetLowerBound 999999 $zz.$setNo smallSetUpperBound 0 @@ -465,6 +472,7 @@ proc z39search {setNo piggy tno elements} { $zz.$setNo search $query if {[catch {zwait sessionWait 600}]} { + wlog debug "timeout/cancel in present" displayError "Timeout in search" {} html "\n" $zz disconnect @@ -533,6 +541,7 @@ proc z39msearch {setNo piggy elements} { global zleft global zstatus global hist + global targets set not $hist($setNo,0,host) @@ -580,9 +589,14 @@ proc z39msearch {setNo piggy elements} { set hist($setNo,$i,offset) 0 eval z39$i.$setNo databaseNames $hist($setNo,$i,database) - z39$i.$setNo smallSetElementSetNames $elements - z39$i.$setNo mediumSetElementSetNames $elements - z39$i.$setNo recordElements $elements + if {![lindex $targets($hist($setNo,$i,host)) 5]} { + set thisElements {} + } else { + set thisElements $elements + } + z39$i.$setNo smallSetElementSetNames $thisElements + z39$i.$setNo mediumSetElementSetNames $thisElements + z39$i.$setNo recordElements $thisElements z39$i.$setNo preferredRecordSyntax USMARC z39$i callback [list search-m-response $setNo $i] @@ -622,16 +636,26 @@ proc z39msearch {setNo piggy elements} { proc z39present {setNo tno setOffset setMax dfunc elements} { global hist global sessionWait + global targets if {$tno > 0} { set zz z39$tno + set host $hist($setNo,$tno,host) } else { set zz z39 + set host $hist($setNo,host) + } + + if {![lindex $targets($host) 5]} { + set elements {} } $zz.$setNo elementSetNames $elements $zz.$setNo recordElements $elements set toGet [expr 1 + $setMax - $setOffset] + + $zz callback [list search-response $zz.$setNo] + while {$setMax > 0 && $toGet > 0} { for {set got 0} {$got < $toGet} {incr got} { if {[$zz.$setNo type [expr $setOffset + $got]] == ""} { @@ -642,6 +666,7 @@ proc z39present {setNo tno setOffset setMax dfunc elements} { set sessionWait 0 $zz.$setNo present $setOffset $toGet if {[catch {zwait sessionWait 300}]} { + wlog debug "timeout/cancel in present" $zz disconnect break } diff --git a/www/ztargets.conf b/www/ztargets.conf index 9df3236..cda4a19 100644 --- a/www/ztargets.conf +++ b/www/ztargets.conf @@ -1,4 +1,4 @@ -# $Id: ztargets.conf,v 1.10 1995/11/14 09:30:21 adam Exp $ +# $Id: ztargets.conf,v 1.11 1995/11/14 09:53:17 adam Exp $ set commonFields { { Title {@attr 1=4} } { Author {@attr 1=1003} } @@ -19,6 +19,7 @@ set targets(myriad.middlebury.edu) { } {} {Myriad} + 1 } set targets(rlg.stanford.edu) [list \ @@ -26,7 +27,8 @@ set targets(rlg.stanford.edu) [list \ {BKS AMC MAP MDF REC SCO SER VIM BIB} \ $commonFields \ {} \ - {Research Libraries group, Stanford University} + {Research Libraries group, Stanford University} \ + 1 ] set targets(z3950.bibsys.no:2100) [list \ @@ -35,6 +37,7 @@ set targets(z3950.bibsys.no:2100) [list \ $commonFields \ {} \ {BIBSYS - Norway} \ + 0 \ ] set targets(dtbsun.dtv.dk:4500) [list \ @@ -43,6 +46,7 @@ set targets(dtbsun.dtv.dk:4500) [list \ $commonFields \ {} \ {Aleph, Z39.50 Server on DTV} \ + 0 \ ] set targets(dtbsun.dtv.dk:210) [list \ @@ -56,6 +60,7 @@ set targets(dtbsun.dtv.dk:210) [list \ } \ {<>} \ {SR Target DanBib through the Europagate gateway} \ + 0 \ ] set targets(localhost:9999) [list \ @@ -64,6 +69,7 @@ set targets(localhost:9999) [list \ $commonFields \ {} \ {Test server on localhost} \ + 1 \ ] set targets(dtbsun.dtv.dk:9999) { @@ -80,6 +86,7 @@ set targets(dtbsun.dtv.dk:9999) { } {} {New Index Data Z39.50 Server in alpha-test} + 1 } set targets(z3950.research.att.com) [list \ @@ -88,6 +95,7 @@ set targets(z3950.research.att.com) [list \ $commonFields \ {} \ {Z39.50 Server at AT&T} \ + 1 \ ] set targets(dranet.dra.com) [list \ @@ -96,4 +104,5 @@ set targets(dranet.dra.com) [list \ $commonFields \ {} \ {Data Research Z39.50 Server} \ + 1 \ ]