X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=web%2Fhtdocs%2Fdetails%2Ffound.mc;h=040318e820633787812e26d7a0e79e0bde6d6a19;hb=0ce213161741b7726ac32bd6c76bbef7f1dc6ab7;hp=c3063753ab999a41253cd5857db677f2a6ffb631;hpb=3bf8463da1c3cfc7f9706dcd372c21d7f9b280c2;p=irspy-moved-to-github.git diff --git a/web/htdocs/details/found.mc b/web/htdocs/details/found.mc index c306375..040318e 100644 --- a/web/htdocs/details/found.mc +++ b/web/htdocs/details/found.mc @@ -1,9 +1,5 @@ -%# $Id: found.mc,v 1.14 2006-10-18 14:03:42 mike Exp $ +%# $Id: found.mc,v 1.28 2007-04-26 13:57:17 mike Exp $ <%once> -use XML::LibXML; -use XML::LibXML::XPathContext; -use URI::Escape; - sub print_navlink { my($params, $cond, $caption, $skip) = @_; @@ -23,6 +19,21 @@ sub navlink { return $url; } +# Identical to the same-named function in full.mc +# So maybe this should go into IRSpy::Utils.pm? +# +sub calc_reliability { + my($xc) = @_; + + my @allpings = $xc->findnodes("i:status/i:probe"); + my $nall = @allpings; + return "[untested]" if $nall == 0; + my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]'); + my $nok = @okpings; + return "$nok/$nall = " . int(100*$nok/$nall) . "%"; +} + + # Just make this once; forge the connection on first use our $conn = undef; %once> @@ -41,7 +52,7 @@ if ($params{_query}) { $query .= "$key = ($val)"; } } -$query = 'cql.allRecords=x' if $query eq ""; +$query = 'cql.allRecords=1' if $query eq ""; my $sort = $params{"_sort"}; if ($sort) { @@ -58,10 +69,9 @@ if ($sort) { my $tried_to_open = 0; if (!defined $conn) { OPEN: - $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1"); + $conn = new ZOOM::Connection("localhost:8018/IR-Explain---1"); $conn->option(elementSetName => "zeerex"); } -my $parser = new XML::LibXML(); my $rs; eval { $rs = $conn->search(new ZOOM::Query::CQL($query)) }; @@ -82,10 +92,10 @@ my $first = $skip+1; my $last = $first+$count-1; $last = $n if $last > $n; %perl> -
+% if ($n == 0) { No matches @@ -105,7 +115,8 @@ print_navlink(\%params, $last < $n, "Next", $skip+$count);