From: Adam Dickmeiss Date: Mon, 11 Mar 1996 17:40:47 +0000 (+0000) Subject: Result set merge. X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=02d3e042a063e539acce998f74b00a09df000cd0;p=egate.git Result set merge. --- diff --git a/www/Makefile b/www/Makefile index 15b376e..f201b75 100644 --- a/www/Makefile +++ b/www/Makefile @@ -1,7 +1,7 @@ # Makefile for www gateway utility # Europagate, 1995 # -# $Id: Makefile,v 1.35 1996/03/07 13:18:52 adam Exp $ +# $Id: Makefile,v 1.36 1996/03/11 17:40:47 adam Exp $ # SHELL=/bin/sh @@ -20,7 +20,8 @@ TCLLIB=/usr/local/lib/libtcl7.5.a TCLINC= WSCRIPTS=egwscript targets.egw query.egw search.egw showfull.egw z39util.tcl \ - mtargets.egw mquery.egw msearch.egw history.egw tform.egw tdefine.egw sameas.egw + mtargets.egw mquery.egw msearch.egw history.egw tform.egw tdefine.egw \ + sameas.egw nwi.egw HSCRIPTS=egwindex.html CONFFILES=egw.res ztargets.conf TPROG1=egwcgi diff --git a/www/egwindex.html b/www/egwindex.html index 240fd92..33b94d0 100644 --- a/www/egwindex.html +++ b/www/egwindex.html @@ -3,7 +3,7 @@ Europagate WWW index -

Europagate WWW index, $Id: egwindex.html,v 1.10 1996/03/05 18:50:24 adam Exp $

+

Europagate WWW index, $Id: egwindex.html,v 1.11 1996/03/11 17:40:47 adam Exp $

diff --git a/www/msearch.egw b/www/msearch.egw index 084353d..e31fff3 100644 --- a/www/msearch.egw +++ b/www/msearch.egw @@ -1,6 +1,6 @@ { -# $Id: msearch.egw,v 1.17 1996/03/08 16:47:04 adam Exp $ +# $Id: msearch.egw,v 1.18 1996/03/11 17:40:47 adam Exp $ if {[info commands saveState] == ""} { source z39util.tcl @@ -16,7 +16,17 @@ set setNo [lindex $sessionParms 0] - if {[egw_form menu1] != ""} { + if {[string length [egw_form entry1]] > 0} { + if {[string length [egw_form host]] > 0} { + set hist($setNo,0,host) [llength [egw_form host]] + set i 1 + foreach t [egw_form host] { + set hist($setNo,$i,host) $t + set hist($setNo,$i,database) [splitDatabaseSpec $t] + set hist($setNo,$i,idAuthentication) {} + incr i + } + } set hist($nextSetNo,0,host) $hist($setNo,0,host) for {set i 1} {$i <= $hist($setNo,0,host)} {incr i} { set hist($nextSetNo,$i,host) $hist($setNo,$i,host) @@ -70,7 +80,6 @@ html $e {: } $env($e) {
} \n } html "form: " [egw_form] "
\n" - html "target: " $host "
\n" html "query: --" $hist($setNo,1,query) "--
\n" html "database: " $hist($setNo,1,database) "
\n" html "sort: " $hist($setNo,sort) "
\n" diff --git a/www/search.egw b/www/search.egw index 425c829..5c90170 100644 --- a/www/search.egw +++ b/www/search.egw @@ -1,6 +1,6 @@ { -# $Id: search.egw,v 1.35 1996/03/08 16:47:05 adam Exp $ +# $Id: search.egw,v 1.36 1996/03/11 17:40:48 adam Exp $ proc start-scan {scanNo targetNo cache dir initSet} { global sessionId @@ -224,6 +224,9 @@ proc start-scan {scanNo targetNo cache dir initSet} { if {$hist($setNo,maxPresent) == ""} { set hist($setNo,maxPresent) 30 } + set hist($setNo,format) brief + set hist($setNo,sort) server + set i [lindex $sessionParms 2] if {$i == ""} { for {set j 1} {$j <= 3} {incr j} { diff --git a/www/showfull.egw b/www/showfull.egw index 4c708dd..9953ccd 100644 --- a/www/showfull.egw +++ b/www/showfull.egw @@ -1,6 +1,6 @@ { -# $Id: showfull.egw,v 1.20 1996/03/07 12:46:09 adam Exp $ +# $Id: showfull.egw,v 1.21 1996/03/11 17:40:48 adam Exp $ proc buttons {setNo tno no format count host after} { global sessionId @@ -89,7 +89,7 @@ proc buttons {setNo tno no format count host after} { set zz z39$tno set host $hist($setNo,$tno,host) - html " WWW/Z39.50 Gateway Record " [splitHostSpec $host] + html "<head><title> WWW/Z39.50 Gateway Record " [lindex $targets($host) 0] html " \n" html "\n" @@ -102,7 +102,8 @@ proc buttons {setNo tno no format count host after} { set useIcons 1 buttons $setNo $tno $no $format $count $host 0 - html "

Record \#$no out of $count


\n" + html "

Record \#$no out of $count in " [lindex $targets($host) 0] + html "


\n" eval {z39present $setNo $tno $no $no display-$format F} set useIcons 0 diff --git a/www/z39util.tcl b/www/z39util.tcl index bfa5608..9efda0b 100644 --- a/www/z39util.tcl +++ b/www/z39util.tcl @@ -1,5 +1,5 @@ # -# $Id: z39util.tcl,v 1.37 1996/03/08 16:47:08 adam Exp $ +# $Id: z39util.tcl,v 1.38 1996/03/11 17:40:49 adam Exp $ # proc saveState {} { uplevel #0 { @@ -65,7 +65,7 @@ proc fail-response {} { set sessionWait -1 } -proc display-brief {zset no setNo targetNo} { +proc display-medium {zset no setNo targetNo} { global env global sessionId @@ -84,21 +84,131 @@ proc display-brief {zset no setNo targetNo} { return } set rtype [$zset recordType $no] - if {$rtype == "SUTRS"} { + switch $rtype { + SUTRS { + html { } + html [join [$zset getSutrs $no]] + html "
\n" + return + } + WAIS { + html { } + html [join [$zset getWAIS $no headline]] + html {} + html "
\n" + html {Score: } [$zset getWAIS $no score] + set lines [$zset getWAIS $no lines] + if {$lines > 0} { + html {, } $lines { lines} + } + html "
\n" + return + } + } + if {![catch { + set author [$zset getMarc $no field 100 * a] + set corp [$zset getMarc $no field 110 * a] + set meet [$zset getMarc $no field 111 * a] + set title [$zset getMarc $no field 245 * a] + if {[llength $author] == 0} { + set cover [$zset getMarc $no field 245 * {[bc]}] + } else { + set cover [$zset getMarc $no field 245 * b] + } + set location [$zset getMarc $no field 260 * a] + set publisher [$zset getMarc $no field 260 * b] + set year [$zset getMarc $no field 260 * c] + } dispError ] } { html { } - html [join [$zset getSutrs $no]] - html "
\n" - return - } - if {$rtype == "WAIS"} { + set p 0 + foreach a $author { + if {$p} { + html ", " + } + html $a + set p 1 + } + foreach a $corp { + if {$p} { + html ", " + } + html $a + set p 1 + } + foreach a $meet { + if {$p} { + html ", " + } + html $a + set p 1 + } + if {$p} { + html ": " + } + set nope 1 + foreach v $title { + html $v + set nope 0 + } + set v [join $cover ""] + if {[string length $v] > 0} { + set nope 0 + html $v + } elseif {$nope} { + html "No Title" + } + html { } + } else { html { } - html [join [$zset getWAIS $no headline]] - html {} - html "
\n" + html {No Title} + html { } + html "Error: " $dispError "\n" + } + html "
\n" +} + +proc display-brief {zset no setNo targetNo} { + global env + global sessionId + + set type [$zset type $no] + if {$type == "SD"} { + set err [lindex [$zset diag $no] 1] + set add [lindex [$zset diag $no] 2] + if {$add != {}} { + set add " :${add}" + } + html "${no} Error ${err}${add}
\n" + return + } + if {$type != "DB"} { return } + set rtype [$zset recordType $no] + switch $rtype { + SUTRS { + html { } + html [string range [join [$zset getSutrs $no]] 0 70] + html "
\n" + return + } + WAIS { + html { } + html [string range [join [$zset getWAIS $no headline]] 0 70] + + html {} + set score [$zset getWAIS $no score] + html { Score } $score + html "
\n" + return + } + } if {![catch { set author [$zset getMarc $no field 100 * a] set corp [$zset getMarc $no field 110 * a] @@ -140,11 +250,13 @@ proc display-brief {zset no setNo targetNo} { if {$p} { html ": " } + html {} set nope 1 foreach v $title { html $v set nope 0 } + html {} if {$nope} { set v [join $cover ""] if {[string length $v] > 40} { @@ -168,26 +280,36 @@ proc display-brief {zset no setNo targetNo} { html "
\n" } -proc display-raw {zset no tno} { +proc display-raw {zset no setNo targetNo} { set type [$zset type $no] - if {$type == "SD"} { - set err [lindex [$zset diag $no] 1] - set add [lindex [$zset diag $no] 2] - if {$add != {}} { - set add " :${add}" + switch $type { + SD { + set err [lindex [$zset diag $no] 1] + set add [lindex [$zset diag $no] 2] + if {$add != {}} { + set add " :${add}" + } + html "

${no}

\n" + html "Error ${err}${add}
\n" + return + } + DB { + } + default { + return } - html "

${no}

\n" - html "Error ${err}${add}
\n" - return - } - if {$type != "DB"} { - return } set rtype [$zset recordType $no] - if {$rtype == "SUTRS"} { - html [join [$zset getSutrs $no]] "
\n" - return - } + switch $rtype { + SUTRS { + html "\n" [join [$zset getSutrs $no]] "\n\n" + return + } + WAIS { + html "\n" [join [$zset getWAIS $no text]] "\n\n" + return + } + } if {[catch {set r [$zset getMarc $no line * * *]}]} { html "Unknown record type: $rtype
\n" return @@ -305,110 +427,11 @@ proc dl-marc-field-rec {zset no tag lead start stop startid sep} { } } -proc display-full-wais {zset no setNo targetNo} { +proc display-full-marc {zset no setNo targetNo} { global env global hist global sessionId - set i 0 - set element junk - htmlToken l [join [$zset getWAIS $no text]] { - if {[string compare [string index $l 0] {<}]} { - set data($element) $l - continue - } - switch -exact $l { - { - set element title - } - { - set element dateOfLastModification - } - { - set element controlIdentifier - } - { - set element lastChecked - } - { - set element bytes - } - { - set element linkage - } - { - incr i - } -
  • { - set element "$i,linkage" - } - { - set element "$i,title" - } - default { - set element junk - } - } - } - if {![info exists data(title)] || ![info exists data(linkage)]} { - html "
    " [join [$zset getWAIS $no text]] "\n
    \n" - return - } - html {Title: } {} $data(title) "
    \n" - html {URL: } $data(linkage) "
    \n" - html {Score: } [$zset getWAIS $no score] "
    \n" - html {Lines: } [$zset getWAIS $no lines] "
    \n" - if {[info exists data(bytes)]} { - html {Bytes: } $data(bytes) "
    \n" - } - if {[info exists data(dateOfLastModification)]} { - html {Last modified: } $data(dateOfLastModification) "
    \n" - } - if {[info exists data(lastChecked)]} { - html {Last checked: } $data(lastChecked) "
    \n" - } - html {} - html {Similar WAIS record
    } - html "
      \n" - for {set i 1} {[info exists data($i,linkage)]} {incr i} { - html {
    • } - html $data($i,title) "
      \n" - html "URL: " $data($i,linkage) - } - html "
    \n" -} - -proc display-full {zset no setNo targetNo} { - set type [$zset type $no] - if {$type == "SD"} { - set err [lindex [$zset diag $no] 1] - set add [lindex [$zset diag $no] 2] - if {$add != {}} { - set add " :${add}" - } - html "Error ${err}${add}
    \n" - return - } - if {$type != "DB"} { - return - } - set rtype [$zset recordType $no] - if {$rtype == "SUTRS"} { - html "
    "
    -        html [join [$zset getSutrs $no]]
    -        html "

    \n" - return - } - if {$rtype == "WAIS"} { - display-full-wais $zset $no $setNo $targetNo - return - } - if {[catch {set r [$zset getMarc $no line * * *]}]} { - html "Unknown record type: $rtype
    \n" - return - } html "
    \n" set n [dl-marc-field $zset $no 700 a "Author" "Authors" "
    \n"] if {$n == 0} { @@ -501,6 +524,144 @@ proc display-full {zset no setNo targetNo} { html "
    \n" } +proc display-full-wais {zset no setNo targetNo} { + global env + global hist + global sessionId + + set i 0 + set element junk + htmlToken l [join [$zset getWAIS $no text]] { + if {[string compare [string index $l 0] {<}]} { + if {[info exist data($element)]} { + set data($element) $data($element)$l + } else { + set data($element) $l + } + continue + } + switch -- $l { + { + set element title + } + { + set element dateOfLastModification + } + { + set element controlIdentifier + } + { + set element lastChecked + } + { + set element bytes + } + { + set element linkage + } + { + incr i + } +
  • { + set element "$i,linkage" + } + { + set element "$i,title" + } + { + set element ip + } + default { + set element junk + } + } + } + if {![info exists data(title)] || ![info exists data(linkage)]} { + set nwi 0 + } else { + set nwi 1 + } + if {$nwi} { + html {Title: } $data(title) "
    \n" + html {URL: } $data(linkage) "
    \n" + } else { + html {Title: } [join [$zset getWAIS $no headline]] "
    \n" + } + html {Score: } [$zset getWAIS $no score] "
    \n" + set lines [$zset getWAIS $no lines] + if {$lines > 0} { + html {Lines: } $lines "
    \n" + } + if {!$nwi} { + html "
    \n" [join [$zset getWAIS $no text]] "\n
    \n" + return + } + if {[info exists data(bytes)]} { + html {Bytes: } $data(bytes) "
    \n" + } + if {[info exists data(dateOfLastModification)]} { + html {Last modified: } $data(dateOfLastModification) "
    \n" + } + if {[info exists data(lastChecked)]} { + html {Last checked: } $data(lastChecked) "
    \n" + } + if {[info exists data(ip)]} { + html {
    Initial text
    } $data(ip) "

    \n" + } + + html {} + html {Similar WAIS record
    } + html "
    References\n
    \n" + for {set i 1} {[info exists data($i,linkage)]} {incr i} { + html {} + if {[info exists data($i,title)]} { + html $data($i,title) + } else { + html Untitled + } + html "
    \n" + } + html "
    \n" +} + +proc display-full {zset no setNo targetNo} { + set type [$zset type $no] + switch $type { + SD { + set err [lindex [$zset diag $no] 1] + set add [lindex [$zset diag $no] 2] + if {$add != {}} { + set add " :${add}" + } + html "Error ${err}${add}
    \n" + return + } + DB { + } + default { + return + } + } + set rtype [$zset recordType $no] + switch $rtype { + SUTRS { + html "
    " [join [$zset getSutrs $no]] "

    \n" + return + } + WAIS { + display-full-wais $zset $no $setNo $targetNo + return + } + } + if {[catch {set r [$zset getMarc $no line * * *]}]} { + html "Unknown record type: $rtype
    \n" + return + } + display-full-marc $zset $no $setNo $targetNo +} + proc display-rec {from to dfunc setNo targetNo} { while {$from <= $to} { @@ -1021,8 +1182,12 @@ proc z39msearch {setNo elements start number cache} { } set zstatus($i) 1 incr zleft - egw_log debug "setNo=$setNo msearch " $hist($setNo,$i,query) - z39$i.$setNo search $hist($setNo,$i,query) + egw_log debug "msearch host=" $hist($setNo,$i,host) + egw_log debug "setNo=$setNo query=" $hist($setNo,$i,query) "=" + if {[catch {z39$i.$setNo search $hist($setNo,$i,query)}]} { + set zstatus($i) -1 + incr zleft -1 + } } elseif {[z39$i.$setNo resultCount] >= $start} { if {[expr $start + $number - 1] > [z39$i.$setNo resultCount]} { set tnumber [expr [z39$i.$setNo resultCount] - $start + 1] @@ -1173,6 +1338,10 @@ proc buttons-result-set-s {setNo targetNo setMax startPos after} { html "

    \n" } +proc score-sort {l r} { + return [expr [lindex $r 0] - [lindex $l 0]] +} + proc display-result-set-m-score {setNo} { global hist global useIcons @@ -1181,23 +1350,38 @@ proc display-result-set-m-score {setNo} { set not $hist($setNo,0,host) for {set i 1} {$i <= $not} {incr i} { - if {[lindex $status 0] != "DBOSD"} continue - + if {$zstatus($i) != 2} continue + set status [z39$i.$setNo responseStatus] + if {[lindex $status 0] != "DBOSD"} continue if {$hist($setNo,$i,offset) > $hist($setNo,maxPresent)} { - set nor $hist($setNo,$i,maxPresent) + set nor $hist($setNo,maxPresent) } else { set nor $hist($setNo,$i,offset) } - for {set j 1} {$j < $not} {incr j} { - if {![string compare [z39$i.$setNo recordType] WAIS]} { - lappend scoreArray [list \ - [z39$i.$setNo getWAIS $j score] $i $setNo $j] + for {set j 1} {$j <= $nor} {incr j} { + if {![string compare [z39$i.$setNo recordType $j] WAIS]} { + set score [z39$i.$setNo getWAIS $j score] + if {$score > 0} { + lappend scoreArray [list $score $i $j] + } } else { - lappend scoreArray [list 0 $i $setNo $j] + lappend scoreArray [list 10 $i $j] } } } - html "score merge
    " + if {![info exists scoreArray]} { + html "

    Search produced no result


    \n" + return + } + set scoreSorted [lsort -command score-sort $scoreArray] + + html "
      \n" + foreach r $scoreSorted { + set i [lindex $r 1] + set j [lindex $r 2] + display-$hist($setNo,format) z39$i.$setNo $j $setNo $i + } + html "

    \n" } proc display-result-set-m-server {setNo} { @@ -1220,16 +1404,14 @@ proc display-result-set-m-server {setNo} { html "Error\n
    NSD$code: $msg: $addinfo" } else { set r [z39$i.$setNo resultCount] - html "$r hits\n
    \n
      \n" + html "$r hits\n
      \n" if {$hist($setNo,$i,offset) > $hist($setNo,maxPresent)} { - display-rec 1 $hist($setNo,maxPresent) \ - display-brief $setNo $i + set nor $hist($setNo,maxPresent) } else { - display-rec 1 $hist($setNo,$i,offset) \ - display-brief $setNo $i + set nor $hist($setNo,$i,offset) } - html "
    " + display-rec 1 $nor display-$hist($setNo,format) $setNo $i } html "\n" } diff --git a/www/ztargets.conf b/www/ztargets.conf index 90e5d7a..0fdadb5 100644 --- a/www/ztargets.conf +++ b/www/ztargets.conf @@ -1,4 +1,4 @@ -# $Id: ztargets.conf,v 1.28 1996/03/08 16:47:09 adam Exp $ +# $Id: ztargets.conf,v 1.29 1996/03/11 17:40:49 adam Exp $ # # This file contains the predefined targets in the WWW-Z39.50 gateway # Each target is an entry in the associative array "targets". The @@ -54,7 +54,7 @@ set targets(myriad.middlebury.edu/MIDCAT) { set targets(rlg.stanford.edu/SAM) [list \ RLG \ USMARC \ - $commonFields \ + $locFields \ {} \ {Research Libraries group, Stanford University. Sample database} \ 1 \ @@ -196,7 +196,7 @@ set targets(nwi.ub2.lu.se/sverige) { set targets(netsrv.casi.sti.nasa.gov:10210/GILS) { NASA - WAIS \ + WAIS { { Ranked {@attr 1=4} } } {} {NASA database} @@ -206,7 +206,7 @@ set targets(netsrv.casi.sti.nasa.gov:10210/GILS) { set targets(nwi.ub2.lu.se/new_nor_lib) { NWI-Norway - {} + WAIS { { Ranked {@attr 1=4} } } {} {Nordic Web Index - Norway}