--- trunk/Split.pm 2004/08/08 19:22:56 4 +++ trunk/Split.pm 2004/08/11 14:28:40 5 @@ -17,6 +17,11 @@ use Data::Dumper; +use constant { + ADDED => 1, + DELETED => 2, +}; + =head1 NAME SWISH::Split - Perl interface to split index variant of Swish-e @@ -167,29 +172,37 @@ my @paths = @_ || return; + foreach my $path (@paths) { + $self->{'paths'}->{$path} = DELETED; + } + return 42; } -=head2 finish +=head2 done Finish indexing and close index file(s). - $i->finish; + $i->done; This is most time-consuming operation. When it's called, it will re-index all entries which haven't changed in all slices. Returns number of slices updated. +This method should really be called close or finish, but both of those are +allready used. + =cut -sub finish { +sub done { my $self = shift; my $ret = 0; foreach my $s (keys %{$self->{'slice'}}) { + print STDERR "closing slice $s\n"; $ret += $self->close_slice($s); } @@ -212,6 +225,11 @@ sub swishpaths { my $self = shift; + + my $s = shift || return; + return if (! exists($self->{'slice'}->{'s'})); + + return keys %{$self->{'slice'}->{'s'}}; } =head2 swishpaths_updated @@ -313,7 +331,6 @@ sub find_paths { my $self = shift; - my $s = shift || return; } @@ -463,6 +480,9 @@ $self->slice_output($s); + + $self->{'paths'}->{$path} = ADDED; + return $s; } @@ -499,7 +519,7 @@ return 1; } -=head2 close_slice { +=head2 close_slice Close slice (terminates swish-e process for that slice). @@ -567,7 +587,7 @@ __END__ -=head2 Searching +=head1 Searching Searching is still conducted using L, but you have to glob index names. @@ -582,11 +602,11 @@ That would also benefit performance, but it increases indexing time because merged indexes must be re-created on each indexing run. -=head2 EXPORT +=head1 EXPORT Nothing by default. -=head2 EXAMPLES +=head1 EXAMPLES Test script for this module uses all parts of API. It's also nice example how to use C.