From: Mike Taylor Date: Fri, 15 Dec 2006 18:18:46 +0000 (+0000) Subject: Nicely rendered BIB-1 table. X-Git-Tag: CPAN-v1.02~54^2~607 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=52ecdbad43c852aa70bf3fea418e5e9543fcd3fa;hp=7ab702fa95417687a1a8ad4e72985d4e21abeaab Nicely rendered BIB-1 table. Everything else silent for now. --- diff --git a/web/htdocs/details/stats.mc b/web/htdocs/details/stats.mc index fad2c11..0f26407 100644 --- a/web/htdocs/details/stats.mc +++ b/web/htdocs/details/stats.mc @@ -1,4 +1,4 @@ -%# $Id: stats.mc,v 1.3 2006-12-15 14:37:03 mike Exp $ +%# $Id: stats.mc,v 1.4 2006-12-15 18:18:46 mike Exp $ <%doc> Here are the headings in the Z-Spy version: The ten most commonly supported Bib-1 Use attributes @@ -17,17 +17,73 @@ couched searchges, but it would still be necessary to trawl the records in order to find all the results, so we just take the path of least resistance and look at all the records by hand. +<%args> +$query => undef + <%perl> -my $stats = $m->cache->get("stats"); +my $key = defined $query ? $query : ""; +my $from_cache = 1; +my $stats = $m->cache->get($key); if (defined $stats) { - print "

Reusing cached result

\n"; - print "stats=$stats\n"; } else { - print "

Recalculating stats

\n"; - $stats = new ZOOM::IRSpy::Stats("localhost:3313/IR-Explain---1"); - $m->cache->set("stats", $stats, "1 minute"); + $from_cache = 0; + $stats = new ZOOM::IRSpy::Stats("localhost:3313/IR-Explain---1", $query); + $m->cache->set($key, $stats, "1 minute"); } -print "
";
-$stats->print();
-print "
\n"; +

Statistics for <% $stats->{conn}->option("host") %>

+

<% $stats->{n} %> targets analysed + <% defined $query ? "for '" . xml_encode($query) . "'" : "" %>

+% if ($from_cache) { +

Reusing cached result

+% } else { +

Recalculating stats

+% } + +

Top 10 Bib-1 Attributes

+ + + + + + +<%perl> +my $hr; +$hr = $stats->{bib1AccessPoints}; +foreach my $key ((sort { $hr->{$b} <=> $hr->{$a} + || $a <=> $b } keys %$hr)[0..9]) { + + + + + + +% } +
AttributeName# Db
<% xml_encode($key) %>unknown<% xml_encode($hr->{$key}) . " (" . + 100*$hr->{$key}/$stats->{n} . "%)" %>
+ +<%doc> + print "\nRECORD SYNTAXES\n"; + $hr = $stats->{recordSyntaxes}; + foreach my $key (sort { $hr->{$b} <=> $hr->{$a} + || $a cmp $b } keys %$hr) { + print sprintf("%-26s%5d (%d%%)\n", + $key, $hr->{$key}, 100*$hr->{$key}/$stats->{n}); + } + + print "\nEXPLAIN SUPPORT\n"; + $hr = $stats->{explain}; + foreach my $key (sort { $hr->{$b} <=> $hr->{$a} + || $a cmp $b } keys %$hr) { + print sprintf("%-26s%5d (%d%%)\n", + $key, $hr->{$key}, 100*$hr->{$key}/$stats->{n}); + } + + print "\nTOP-LEVEL DOMAINS\n"; + $hr = $stats->{domains}; + foreach my $key (sort { $hr->{$b} <=> $hr->{$a} + || $a cmp $b } keys %$hr) { + print sprintf("%-26s%5d (%d%%)\n", + $key, $hr->{$key}, 100*$hr->{$key}/$stats->{n}); + } +