/[SWISH-Split]/trunk/Split.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

Diff of /trunk/Split.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by dpavlin, Sun Aug 8 19:22:56 2004 UTC revision 5 by dpavlin, Wed Aug 11 14:28:40 2004 UTC
# Line 17  use File::Which; Line 17  use File::Which;
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
# Line 167  sub delete { Line 172  sub delete {
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    
# Line 212  Return array of C<swishpath>s in index. Line 225  Return array of C<swishpath>s in index.
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
# Line 313  which hasn't changed a while (so, expire Line 331  which hasn't changed a while (so, expire
331  sub find_paths {  sub find_paths {
332          my $self = shift;          my $self = shift;
333    
         my $s = shift || return;  
334  }  }
335    
336    
# Line 463  sub put_slice { Line 480  sub put_slice {
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    
# Line 499  sub slice_output { Line 519  sub slice_output {
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    
# Line 567  sub to_xml { Line 587  sub to_xml {
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.
# Line 582  not change your source code at all. Line 602  not change your source code at all.
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>.

Legend:
Removed from v.4  
changed lines
  Added in v.5

  ViewVC Help
Powered by ViewVC 1.1.26