/[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 8 by dpavlin, Sun Dec 19 03:06:01 2004 UTC revision 13 by dpavlin, Fri Apr 29 23:25:02 2005 UTC
# Line 4  use 5.008; Line 4  use 5.008;
4  use strict;  use strict;
5  use warnings;  use warnings;
6    
7  our $VERSION = '0.02';  our $VERSION = '0.03';
8    
9  use SWISH::API;  use SWISH::API;
10  use Text::Iconv;  use Text::Iconv;
# Line 97  By default, it's C<ISO-8859-1>. Line 97  By default, it's C<ISO-8859-1>.
97  =item C<swish_config>  =item C<swish_config>
98    
99  additional parametars which will be inserted into  additional parametars which will be inserted into
100  C<swish-e> configuration file. See L<swish-config>.  C<swish-e> configuration file. See C<swish-config>.
101    
102  =item C<memoize_to_xml>  =item C<memoize_to_xml>
103    
# Line 159  Delete documents from index. Line 159  Delete documents from index.
159    
160    $i->delete(@swishpath);    $i->delete(@swishpath);
161    
162    B<This function is not implemented.>
163    
164  =cut  =cut
165    
166  sub delete {  sub delete {
# Line 170  sub delete { Line 172  sub delete {
172                  $self->{'paths'}->{$path} = DELETED;                  $self->{'paths'}->{$path} = DELETED;
173          }          }
174    
175            die "delete is not yet implemented";
176    
177          return 42;          return 42;
178  }  }
179    
# Line 396  DEFAULT_SWISH_CONF Line 400  DEFAULT_SWISH_CONF
400  =head2 create_slice  =head2 create_slice
401    
402  On first run, starts C<swish-e>. On subsequent calls just return  On first run, starts C<swish-e>. On subsequent calls just return
403  it's handles using L<Memoize>.  it's handles using C<Memoize>.
404    
405    my $s = create_slice('/path/to/document');    my $s = create_slice('/path/to/document');
406    
# Line 417  sub create_slice { Line 421  sub create_slice {
421          my $swish_config = $self->make_config($s);          my $swish_config = $self->make_config($s);
422    
423          my $swish = qq{| swish-e };          my $swish = qq{| swish-e };
424          $swish .= qq{ -u } if (-f $self->{'index'}.'/'.$s);              if (-f $self->{'index'}.'/'.$s) {
425                    $swish .= qq{ -u };
426                    $self->{'slice'}->{$s}->{'update_mode'}++;
427            }
428          $swish .= qq{ -S prog -c } . $swish_config;          $swish .= qq{ -S prog -c } . $swish_config;
429    
430          $self->_debug("creating slice $s using $swish");          $self->_debug("creating slice $s using $swish");
# Line 459  sub put_slice { Line 466  sub put_slice {
466    
467          use bytes;      # as opposed to chars          use bytes;      # as opposed to chars
468          my $fh = $self->{'slice'}->{$s}->{'h'} || confess "handle for slice $s undefined";          my $fh = $self->{'slice'}->{$s}->{'h'} || confess "handle for slice $s undefined";
469    
470            my $update_header = "Update-Mode: Index\n";
471            $update_header = '' unless ($self->{'slice'}->{$s}->{'update_mode'});
472    
473          print { $fh } "Path-Name: $path\n".          print { $fh } "Path-Name: $path\n".
474                  "Content-Length: ".(length($xml)+1)."\n".                  "Content-Length: ".(length($xml)+1)."\n" . $update_header .
                 "Update-Mode: Index\n".  
475                  "Document-Type: XML\n\n$xml\n";                  "Document-Type: XML\n\n$xml\n";
476    
477          $self->slice_output($s);          $self->slice_output($s);
# Line 534  Data will not yet be recoded to UTF-8. L Line 544  Data will not yet be recoded to UTF-8. L
544    
545    my $xml = $i->to_xml({ foo => 'bar' });    my $xml = $i->to_xml({ foo => 'bar' });
546    
547  This function is extracted from L<"add"> method so that you can L<Memoize> it.  This function is extracted from L<"add"> method so that you can C<Memoize> it.
548  If your data set has a lot of repeatable data, and memory is not a problem, you  If your data set has a lot of repeatable data, and memory is not a problem, you
549  can add C<memoize_to_xml> option to L<"open_index">.  can add C<memoize_to_xml> option to L<"open_index">.
550    

Legend:
Removed from v.8  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26