/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.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 /Webpacus/lib/Webpacus/Model/WebPAC.pm

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

revision 100 by dpavlin, Tue Nov 22 14:45:17 2005 UTC revision 115 by dpavlin, Wed Nov 23 00:15:01 2005 UTC
# Line 78  sub new { Line 78  sub new {
78                  filters => { foo => sub { shift } },                  filters => { foo => sub { shift } },
79          );          );
80    
81            # default template from config.yaml
82          $self->{template} ||= $c->config->{webpac}->{template};          $self->{template} ||= $c->config->{webpac}->{template};
83    
84          $self->{iconv} = new Text::Iconv(          $self->{iconv} = new Text::Iconv(
# Line 97  sub new { Line 98  sub new {
98  }  }
99    
100  sub search {  sub search {
101          my ( $self, $query ) = @_;          my ( $self, $query, $template ) = @_;
102    
103          my $log = $self->{log};          my $log = $self->{log};
104    
105          $log->debug("search model query: -->$query<--");          $log->debug("search model query: -->$query<--");
106    
107          my $template_filename = $self->{template};          my $template_filename = $template || $self->{template};
108    
109          my @results = $self->{est}->search(          my @results = $self->{est}->search(
110                  query => $query,                  query => $query,
# Line 119  sub search { Line 120  sub search {
120    
121                  my $mfn = $1 if ( $results[$i]->{'@uri'} =~ m#/(\d+)$#);                  my $mfn = $1 if ( $results[$i]->{'@uri'} =~ m#/(\d+)$#);
122    
123                  # $log->debug("load_ds( $mfn )");                  #$log->debug("load_ds( $mfn )");
124    
125                  my $ds = $self->{db}->load_ds( $mfn ) || next;                  my $ds = $self->{db}->load_ds( $mfn ) || $log->error("can't load_ds( $mfn )") && next;
126                    
127                    #$log->debug( "ds = " . Dumper( \@html_results ) );
128    
129                  my $html = $self->{out}->apply(                  my $html = $self->{out}->apply(
130                          template => $template_filename,                          template => $template_filename,
131                          data => $ds,                          data => $ds,
# Line 134  sub search { Line 137  sub search {
137    
138          }          }
139    
140            #$log->debug( '@html_results = ' . Dumper( \@html_results ) );
141    
142          return \@html_results;          return \@html_results;
143  }  }
144    

Legend:
Removed from v.100  
changed lines
  Added in v.115

  ViewVC Help
Powered by ViewVC 1.1.26