Parent Directory | Revision Log
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 |