%# $Id: found.mc,v 1.1 2006-09-15 16:51:51 mike Exp $ <%once> use XML::LibXML; use XML::LibXML::XPathContext; %once> <%perl> my $query = ""; foreach my $key ($r->param()) { next if $key =~ /^_/; my $val = $r->param($key); next if $val eq ""; $query .= " and " if $query ne ""; $query .= "$key = ($val)"; } ### We can think about keeping the Connection object open to re-use # for multiple requests, but that may not get us much. Same applies # for the XML parser. my $conn = new ZOOM::Connection("localhost:1313/IR-Explain---1"); $conn->option(elementSetName => "zeerex"); my $parser = new XML::LibXML(); my $rs = $conn->search(new ZOOM::Query::CQL($query)); my $n = $rs->size(); my $skip = $r->param("_skip") || 0; my $count = $r->param("_count") || 10; my $first = $skip+1; my $last = $first+$count-1; $last = $n if $last > $n; %perl>
<% $query %>
% if ($n == 0) {
No matches
% } elsif ($first > $n) {
Past end of <% $n %> records
% } else {
Records <% $first %> to <% $last %> of <% $n %>
% }
# | Host | Port | DB |
---|---|---|---|
<% $i %> | <% $host %> | <% $port %> | <% $db %> |