1 %# $Id: stats.mc,v 1.8 2007-10-31 16:45:20 mike Exp $
3 Here are the headings in the Z-Spy version:
4 The ten most commonly supported Bib-1 Use attributes
5 Record syntax support by database
7 Z39.50 Protocol Services Support
11 You can see his version live at
12 http://targettest.indexdata.com/stat.php
13 Or a static local copy at ../../../archive/stats.html
15 There may be way to generate some of this information by cleverly
16 couched searchges, but it would still be necessary to trawl the
17 records in order to find all the results, so we just take the path of
18 least resistance and look at all the records by hand.
25 my $key = defined $query ? $query : "";
27 my $stats = $m->cache->get($key);
28 if (!defined $stats || $reload) {
30 $stats = new ZOOM::IRSpy::Stats("localhost:8018/IR-Explain---1", $query);
31 $m->cache->set($key, $stats, "10 minutes");
34 <h2>Statistics for <% xml_encode($stats->{host}) %></h2>
35 <h3><% $stats->{n} %> targets analysed
36 <% defined $query ? "for '" . xml_encode($query) . "'" : "" %></h3>
38 <p>Reusing cached result</p>
40 <p>Recalculating stats</p>
42 <& table, stats => $stats, data => "bib1AccessPoints",
43 title => "The ten most commonly supported Bib-1 Use attributes",
44 headings => [ "Attribute", "Name"],
45 col3 => sub { bib1_access_point(@_) } &>
46 <& table, stats => $stats, data => "recordSyntaxes",
47 title => "Record syntax support by database",
48 headings => [ "Record Syntax"] &>
49 <& table, stats => $stats, data => "explain",
50 title => "Explain Support",
51 headings => [ "Explain Category"] &>
52 <& table, stats => $stats, data => "z3950_init_opt",
53 title => "Z39.50 Protocol Services Support",
54 headings => [ "Service"] &>
55 <& table, stats => $stats, data => "domains",
56 title => "Top Domains",
57 headings => [ "Top Domain"] &>
58 <& table, stats => $stats, data => "implementation",
59 title => "Implementation",
60 headings => [ "Name" ] &>
75 % foreach my $heading ("#", @headings, "# Targets") {
76 <th><% xml_encode($heading) %></th>
83 $hr = $stats->{$data};
84 my @sorted = sort { $hr->{$b} <=> $hr->{$a} || $a <=> $b } keys %$hr;
85 my $n = @sorted; $n = 10 if @sorted > 10;
86 foreach my $i (1..$n) {
87 my $key = $sorted[$i-1];
91 <td><% xml_encode(substr($key, 0, 54), "HUH?") %></td>
92 % if (defined $col3) {
93 <td><% xml_encode(&$col3($key), "HUH2?") %></td>
95 <td><% xml_encode($hr->{$key}, "HUH3?") . " (" .
96 int(10000*$hr->{$key}/$stats->{n})/100 . "%)" %></td>