/[mws]/trunk/search.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/search.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Mon May 3 20:40:40 2004 UTC (19 years, 11 months ago) by dpavlin
File MIME type: text/plain
File size: 810 byte(s)
initial import of MailBox Web Search project
(working primitive indexing and command-line sarching)

1 #!/usr/bin/perl -w
2
3 use Plucene::Simple;
4 use Mail::Box::Manager;
5
6 my $debug = 1;
7
8 my $index = Plucene::Simple->open( "index" ) || die "can't open index: $!";
9 my $mgr = Mail::Box::Manager->new;
10 my $folder; # placeholder for folders
11
12 my @index_ids = $index->search(join(" ",@ARGV));
13
14 my $results = $#index_ids + 1;
15 print "$results results...\n";
16
17 foreach my $index_id (@index_ids) {
18 my ($mbox,$id) = split(/ /,$index_id);
19
20 if (! $folder->{$mbox}) {
21 $folder->{$mbox} = $mgr->open($mbox);
22 print STDERR "## open($mbox)\n" if ($debug);
23 }
24
25 my $message = $folder->{$mbox}->find($id) ||
26 print STDERR "can't find message $id in $mbox. Time to re-index?\n";
27 foreach my $from ($message->from) {
28 print $from->phrase," [",$from->address,"] ",$from->comment,"\n";
29 }
30 print " ",$message->get('Subject'),"\n";
31
32 }

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26