/[mws]/trunk/mbox2plucene.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/mbox2plucene.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations)
Thu May 6 07:22:41 2004 UTC (19 years, 11 months ago) by dpavlin
File MIME type: text/plain
File size: 1204 byte(s)
renamed script to fill index to incicate that it's intended to be used with
Plucene

1 #!/usr/bin/perl -w
2
3 use MWS;
4 use Data::Dumper;
5
6 my $mws = MWS->new('global.conf');
7
8 my $debug = 1;
9
10 foreach my $mbox ($mws->{config}->Parameters('folders')) {
11 my $mbox_path = $mws->{config}->val('folders', $mbox);
12
13 print STDERR "working on $mbox [$mbox_path]\n" if ($debug);
14
15 my $folder = $mws->open_folder($mbox);
16
17 foreach my $message ($folder->messages) {
18
19 my $id = $message->messageId;
20 print "## $id\n";
21
22 my $document = {
23 id => $id,
24 folder => $mbox,
25 };
26
27 foreach my $direction (qw(to from cc bcc)) {
28 foreach my $f ($message->$direction) {
29 print "$direction: ";
30 foreach my $part (qw(phrase address comment)) {
31 next if (! $f->$part);
32 print "[$part]",$f->$part," ";
33 $document->{$direction.'_'.$part} .= $f->$part."\n";
34 }
35 print "\n";
36 # push @{$document->$d.'_phrase'}, $f->phrase,
37 # push @{$document->$d.'_address'}, $f->address,
38 ## push @{$document->$d.'_comment'}, $f->comment,
39 }
40 }
41
42 $document->{'subject'} = $message->get('Subject') || 'no subject';
43 $document->{'body'} = $mws->plain_text_body($message);
44
45 # print Dumper($document);
46 $mws->{index}->add("$mbox $id" => $document);
47
48 }
49
50 $folder->close;
51 }
52
53 $mws->{index}->optimize;

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26