34 |
|
|
35 |
my $o = $q->param('index') || 0; |
my $o = $q->param('index') || 0; |
36 |
my $search = $q->param('q'); |
my $search = $q->param('q'); |
37 |
|
$search = join(" AND ", split(/\s+/, $search)) unless ($search =~ m/(?:AND|OR|\[|\])/); |
38 |
|
|
39 |
my $on_page = 30; |
my $on_page = 30; |
40 |
my $skip = $o * $on_page; |
my $skip = $o * $on_page; |
50 |
|
|
51 |
if (defined($nres)) { |
if (defined($nres)) { |
52 |
$max = $nres->hits; |
$max = $nres->hits; |
53 |
print "Got ", $nres->hits, " results for $search\n"; |
my $time = $nres->hint('TIME'); |
54 |
|
print qq{ |
55 |
|
<div id="status_update" style="display:none;"> |
56 |
|
Got <b>$max</b> results for <tt>$search</tt> in <em>$time s</em> |
57 |
|
</div> |
58 |
|
}; |
59 |
|
|
60 |
sub html_snippet { |
sub html_snippet { |
61 |
my $text = shift || return; |
my $text = shift || return; |
82 |
|
|
83 |
print "<h1>", $rdoc->attr('@title'),"</h1>\n"; |
print "<h1>", $rdoc->attr('@title'),"</h1>\n"; |
84 |
print "<h2>", $rdoc->attr('source'),"</h2>\n"; |
print "<h2>", $rdoc->attr('source'),"</h2>\n"; |
85 |
print "", html_snippet( $rdoc->snippet ),"<br/>\n"; |
print "<h3>", $rdoc->attr('@mdate'),"</h3>\n"; |
86 |
|
print "<p>", html_snippet( $rdoc->snippet ),"</p>\n"; |
87 |
print "[", $skip + $i, "] "; |
print "[", $skip + $i, "] "; |
88 |
print "<tt>", $rdoc->attr('@uri'),"</tt>"; |
print "<tt>", $rdoc->attr('@uri'),"</tt>"; |
89 |
print "</li>"; |
print "</li>"; |