/[webpac]/trunk/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 /trunk/WebPac.pm

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

revision 51 by dpavlin, Sun Jun 1 15:33:08 2003 UTC revision 71 by dpavlin, Sat Jul 5 21:35:44 2003 UTC
# Line 8  use HTML::FillInForm; Line 8  use HTML::FillInForm;
8  use SWISH;  use SWISH;
9  use Text::Iconv;  use Text::Iconv;
10  use DBI;  use DBI;
11    use Config::IniFiles;
12    
13  use lib '..';  use lib '..';
14  use index_DBI;  use index_DBI;
# Line 19  my $TEMPLATE_PATH = '/data/webpac/templa Line 20  my $TEMPLATE_PATH = '/data/webpac/templa
20  my $CHARSET = 'ISO-8859-2';  my $CHARSET = 'ISO-8859-2';
21  my $SWISH = '/usr/bin/swish-e';  my $SWISH = '/usr/bin/swish-e';
22  my $INDEX = '/data/webpac/index/isis.index';  my $INDEX = '/data/webpac/index/isis.index';
23  my $MAX_HITS = 500;  my $MAX_HITS = 0;
24  my $ON_PAGE = 10;  my $ON_PAGE = 10;
25    
26  Text::Iconv->raise_error(0);     # Conversion errors raise exceptions  Text::Iconv->raise_error(0);     # Conversion errors raise exceptions
27    
28  my $from_utf8 = Text::Iconv->new('UTF8', $CHARSET);  my $from_utf8 = Text::Iconv->new('UTF8', $CHARSET);
29    
30    # read global.conf configuration
31    my $cfg_global = new Config::IniFiles( -file => '../global.conf' ) || die "can't open 'global.conf'";
32    
33    
34  sub setup {  sub setup {
35          my $self = shift;          my $self = shift;
36          $self->tmpl_path($TEMPLATE_PATH);          $self->tmpl_path($TEMPLATE_PATH);
# Line 70  sub show_results_list { Line 75  sub show_results_list {
75          my @path_arr = $q->param('path');          my @path_arr = $q->param('path');
76          my $full = $q->param('full');          my $full = $q->param('full');
77    
78          for(my $i = 1; $i <=10; $i++) {          for(my $i = 1; $i <=30; $i++) {
79    
80                  return show_index($self, $i) if ($q->param("f".$i."_index"));                  return show_index($self, $i) if ($q->param("f".$i."_index"));
                 next if (! $q->param("f$i"));  
81                  next if (! $q->param("v$i"));                  next if (! $q->param("v$i"));
82                    next if (! $q->param("f$i"));
83    
84                  # re-write query from +/- to and/and not                  # re-write query from +/- to and/and not
85                  my $s;                  my $s;
# Line 90  sub show_results_list { Line 95  sub show_results_list {
95                                  $s.= ($s) ? "and " : "";                                  $s.= ($s) ? "and " : "";
96                                  $s.="not " if ($1 eq "-");                                  $s.="not " if ($1 eq "-");
97                                  $s.="$2* ";                                  $s.="$2* ";
98                            } elsif (m/(and|or|not)/i) {
99                                    $s.="$_ ";
100                          } else {                          } else {
101                                  $s.="$_* ";                                  $s.="$_* ";
102                          }                          }
# Line 192  sub show_index { Line 199  sub show_index {
199    
200          my $html;          my $html;
201    
202          my $index = new index_DBI();          my $index = new index_DBI(
203                    $cfg_global->val('global', 'dbi_dbd'),
204                    $cfg_global->val('global', 'dbi_dsn'),
205                    $cfg_global->val('global', 'dbi_user'),
206                    $cfg_global->val('global', 'dbi_passwd') || ''
207            );
208    
209          my $total = $index->check($field);          my $total = $index->check($field);
210          if (! $total) {          if (! $total) {

Legend:
Removed from v.51  
changed lines
  Added in v.71

  ViewVC Help
Powered by ViewVC 1.1.26