/[pgestraier]/trunk/bin/pgest-index.pl
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/bin/pgest-index.pl

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

revision 65 by dpavlin, Mon Aug 7 14:47:00 2006 UTC revision 66 by dpavlin, Mon Aug 7 14:56:08 2006 UTC
# Line 22  my $c = { Line 22  my $c = {
22                  select ime,tel from imenik                  select ime,tel from imenik
23          },          },
24          pk_col => 'tel',          pk_col => 'tel',
         db_encoding => 'iso-8859-2',  
25          debug => 1,          debug => 1,
26          user => 'admin',          user => 'admin',
27          passwd => 'admin',          passwd => 'admin',
28  };  };
29    
30  GetOptions($c, qw/node_url=s sql=s pk_col=s eb_encoding=s debug+ user=s passwd=s/);  GetOptions($c, qw/node_url=s sql=s pk_col=s debug+ user=s passwd=s/);
31    
32  warn "# c: ", Dumper($c) if ($c->{debug});  warn "# c: ", Dumper($c) if ($c->{debug});
33    
# Line 106  while (my $row = $sth->fetchrow_hashref( Line 105  while (my $row = $sth->fetchrow_hashref(
105          while (my ($col,$val) = each %{$row}) {          while (my ($col,$val) = each %{$row}) {
106    
107                  if ($val) {                  if ($val) {
                         # change encoding?  
                         from_to($val, ($c->{db_encoding} || 'ISO-8859-1'), 'UTF-8');  
   
108                          # add attributes (make column usable from attribute search)                          # add attributes (make column usable from attribute search)
109                          $doc->add_attr($col, $val);                          $doc->add_attr($col, $val);
110    
# Line 157  $dbh->commit; Line 153  $dbh->commit;
153  my $col_names = join(', ', @cols);  my $col_names = join(', ', @cols);
154  my $col_def = join(', ', map { "$_ text" } @cols);  my $col_def = join(', ', map { "$_ text" } @cols);
155    
156  print "example SQL search query:  print "
157    ## example SQL search query:
158    
159  SELECT $col_names  SELECT $col_names
160  FROM pgest(  FROM pgest(
# Line 166  FROM pgest( Line 162  FROM pgest(
162          '$c->{node_url}', '$c->{user}', '$c->{passwd}', 0,          '$c->{node_url}', '$c->{user}', '$c->{passwd}', 0,
163          -- full text search          -- full text search
164          'foo bar',          'foo bar',
165          -- attribute filter, order by, limit, offset          -- attribute filter, order, limit, offset
166          null, null, null, null,          null, null, null, null,
167          -- return columns          -- return columns
168          array[$cols]          array[$cols]

Legend:
Removed from v.65  
changed lines
  Added in v.66

  ViewVC Help
Powered by ViewVC 1.1.26