#
-# $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 {
}
}
-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]
}
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]
}
proc z39search {setNo piggy tno elements} {
global hist
global sessionWait
+ global targets
if {$tno > 0} {
set zz z39$tno
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
$zz.$setNo search $query
if {[catch {zwait sessionWait 600}]} {
+ wlog debug "timeout/cancel in present"
displayError "Timeout in search" {}
html "</body></html>\n"
$zz disconnect
global zleft
global zstatus
global hist
+ global targets
set not $hist($setNo,0,host)
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]
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]] == ""} {
set sessionWait 0
$zz.$setNo present $setOffset $toGet
if {[catch {zwait sessionWait 300}]} {
+ wlog debug "timeout/cancel in present"
$zz disconnect
break
}
-# $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} }
}
{}
{Myriad}
+ 1
}
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 \
$commonFields \
{} \
{BIBSYS - Norway} \
+ 0 \
]
set targets(dtbsun.dtv.dk:4500) [list \
$commonFields \
{} \
{Aleph, Z39.50 Server on DTV} \
+ 0 \
]
set targets(dtbsun.dtv.dk:210) [list \
} \
{<<danbib>>} \
{SR Target DanBib through the Europagate gateway} \
+ 0 \
]
set targets(localhost:9999) [list \
$commonFields \
{} \
{Test server on localhost} \
+ 1 \
]
set targets(dtbsun.dtv.dk:9999) {
}
{}
{New Index Data Z39.50 Server in alpha-test}
+ 1
}
set targets(z3950.research.att.com) [list \
$commonFields \
{} \
{Z39.50 Server at AT&T} \
+ 1 \
]
set targets(dranet.dra.com) [list \
$commonFields \
{} \
{Data Research Z39.50 Server} \
+ 1 \
]