blob: 2bebda8b5cf6036ecd3b9e06c8a0dcf87602b442 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/perl
use lib "../../lib";
use Bucky;
use Bucky::Session;
use Bucky::Search;
my $bucky = new Bucky;
my $session = new Bucky::Session;
my $q = $session->param('q');
print "Content-type: text/plain\n\n";
if (length $q)
{
my $search = new Bucky::Search;
my $results = $search->search_light($q, 0, 40);
foreach my $result (@{$results->{'results'}})
{
my $thread = $results->{'threads'}->{ $result->{'thread'} };
my $comment = $results->{'comments'}->{ $result->{'comment'} };
my $file = $results->{'files'}->{ $result->{'file'} };
my $z_thread = $thread->{'id'};
my $z_title = $search->bold_terms( $thread->{'title'}, $terms);
my $z_file = $file->{'id'};
my $z_subtitle = $file->{'filename'};
$z_subtitle =~ s/[^a-zA-Z0-9 ()\.]/ /g;
$z_subtitle =~ s/_/ /g;
$z_subtitle =~ s/\s+/ /g;
$z_subtitle =~ s/^\s//;
$z_subtitle =~ s/\s$//;
print join "\t", $z_thread, $z_title, $z_subtitle, $z_file;
print "\n";
}
$search->log_query($query, $total);
}
else
{
print "\n";
}
1;
|