17 |
|
|
18 |
use Data::Dumper; |
use Data::Dumper; |
19 |
|
|
20 |
|
use constant { |
21 |
|
ADDED => 1, |
22 |
|
DELETED => 2, |
23 |
|
}; |
24 |
|
|
25 |
=head1 NAME |
=head1 NAME |
26 |
|
|
27 |
SWISH::Split - Perl interface to split index variant of Swish-e |
SWISH::Split - Perl interface to split index variant of Swish-e |
172 |
|
|
173 |
my @paths = @_ || return; |
my @paths = @_ || return; |
174 |
|
|
175 |
|
foreach my $path (@paths) { |
176 |
|
$self->{'paths'}->{$path} = DELETED; |
177 |
|
} |
178 |
|
|
179 |
return 42; |
return 42; |
180 |
} |
} |
181 |
|
|
182 |
|
|
183 |
=head2 finish |
=head2 done |
184 |
|
|
185 |
Finish indexing and close index file(s). |
Finish indexing and close index file(s). |
186 |
|
|
187 |
$i->finish; |
$i->done; |
188 |
|
|
189 |
This is most time-consuming operation. When it's called, it will re-index |
This is most time-consuming operation. When it's called, it will re-index |
190 |
all entries which haven't changed in all slices. |
all entries which haven't changed in all slices. |
191 |
|
|
192 |
Returns number of slices updated. |
Returns number of slices updated. |
193 |
|
|
194 |
|
This method should really be called close or finish, but both of those are |
195 |
|
allready used. |
196 |
|
|
197 |
=cut |
=cut |
198 |
|
|
199 |
sub finish { |
sub done { |
200 |
my $self = shift; |
my $self = shift; |
201 |
|
|
202 |
my $ret = 0; |
my $ret = 0; |
203 |
|
|
204 |
foreach my $s (keys %{$self->{'slice'}}) { |
foreach my $s (keys %{$self->{'slice'}}) { |
205 |
|
print STDERR "closing slice $s\n"; |
206 |
$ret += $self->close_slice($s); |
$ret += $self->close_slice($s); |
207 |
} |
} |
208 |
|
|
225 |
|
|
226 |
sub swishpaths { |
sub swishpaths { |
227 |
my $self = shift; |
my $self = shift; |
228 |
|
|
229 |
|
my $s = shift || return; |
230 |
|
return if (! exists($self->{'slice'}->{'s'})); |
231 |
|
|
232 |
|
return keys %{$self->{'slice'}->{'s'}}; |
233 |
} |
} |
234 |
|
|
235 |
=head2 swishpaths_updated |
=head2 swishpaths_updated |
331 |
sub find_paths { |
sub find_paths { |
332 |
my $self = shift; |
my $self = shift; |
333 |
|
|
|
my $s = shift || return; |
|
334 |
} |
} |
335 |
|
|
336 |
|
|
480 |
|
|
481 |
$self->slice_output($s); |
$self->slice_output($s); |
482 |
|
|
483 |
|
|
484 |
|
$self->{'paths'}->{$path} = ADDED; |
485 |
|
|
486 |
return $s; |
return $s; |
487 |
} |
} |
488 |
|
|
519 |
return 1; |
return 1; |
520 |
} |
} |
521 |
|
|
522 |
=head2 close_slice { |
=head2 close_slice |
523 |
|
|
524 |
Close slice (terminates swish-e process for that slice). |
Close slice (terminates swish-e process for that slice). |
525 |
|
|
587 |
__END__ |
__END__ |
588 |
|
|
589 |
|
|
590 |
=head2 Searching |
=head1 Searching |
591 |
|
|
592 |
Searching is still conducted using L<SWISH::API>, but you have to glob |
Searching is still conducted using L<SWISH::API>, but you have to glob |
593 |
index names. |
index names. |
602 |
That would also benefit performance, but it increases indexing time |
That would also benefit performance, but it increases indexing time |
603 |
because merged indexes must be re-created on each indexing run. |
because merged indexes must be re-created on each indexing run. |
604 |
|
|
605 |
=head2 EXPORT |
=head1 EXPORT |
606 |
|
|
607 |
Nothing by default. |
Nothing by default. |
608 |
|
|
609 |
=head2 EXAMPLES |
=head1 EXAMPLES |
610 |
|
|
611 |
Test script for this module uses all parts of API. It's also nice example |
Test script for this module uses all parts of API. It's also nice example |
612 |
how to use C<SWISH::Split>. |
how to use C<SWISH::Split>. |