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

Annotation of /trunk/MWS_plucene.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (hide annotations)
Thu May 6 12:40:11 2004 UTC (20 years ago) by dpavlin
File size: 612 byte(s)
switch search engine to swish-e. It's stil slow, but usable.

1 dpavlin 9 #!/usr/bin/perl -w
2    
3     use strict;
4    
5     #
6     # simple implementation to use Lucene port to perl
7     #
8    
9     use Plucene::Simple;
10    
11     sub open_index {
12     my $self = shift;
13    
14     my $index_file = shift || croak "open_index needs index filename";
15    
16     $self->{index} = Plucene::Simple->open($index_file) || croak "can't open index '$index_file': $!";
17     return $self->{index};
18    
19     }
20    
21     sub search_index {
22     my $self = shift;
23    
24     my $s = shift || croak "search_index needs query";
25    
26     return $self->{index}->search($s);
27     }
28    
29 dpavlin 12 sub add_index {
30     my $self = shift;
31    
32     $self->{index}->add(@_);
33     }
34    
35     sub close_index {
36     my $self = shift;
37    
38     $self->{index}->optimize;
39     }
40    
41 dpavlin 9 1;

  ViewVC Help
Powered by ViewVC 1.1.26