X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=CROSBI.pm;h=62ae19f61b24b4ef9391e43d873437187fa39c78;hb=a0d3a60cd95afff5241f8e2d3a2955ecdffd1395;hp=c78c9d89ea68c0f4b1768b115a4d59c56218f212;hpb=60c9d4bd5369744b73953915c6efd7eb9d809536;p=Biblio-Z3950.git diff --git a/CROSBI.pm b/CROSBI.pm index c78c9d8..62ae19f 100644 --- a/CROSBI.pm +++ b/CROSBI.pm @@ -8,6 +8,7 @@ use Data::Dump qw/dump/; use DBI; use utf8; +use Scraper; use base 'Scraper'; my $debug = $ENV{DEBUG} || 0; @@ -47,6 +48,9 @@ sub usemap {{ =cut my $dbname = 'bibliografija'; +my $pg_user = $ENV{PGUSER} || ''; +my $pg_passwd = $ENV{PGPASSWD} || ''; +my $pg_host = $ENV{PGHOST} || ''; my @and; my @exec; @@ -96,7 +100,7 @@ inner join rad_ustanova using (id) -- sifra my @or; foreach my $f ( split(/,/,$fti) ) { - push @or, "$f @@ to_tsquery(?)"; + push @or, "$f @@ to_tsquery('english',?)"; push @exec, $tsquery; }; push @and, "( " . join(" or ", @or) . ")"; @@ -110,7 +114,7 @@ inner join rad_ustanova using (id) -- sifra parse_fti $query; } else { # no " AND " in query my $tsquery = join(' & ', split(/\s+/,$query) ); - push @and, "( fti_au @@ to_tsquery(?) or fti_pr @@ to_tsquery(?) )"; + push @and, "( fti_au @@ to_tsquery('english',?) or fti_pr @@ to_tsquery('english',?) )"; push @exec, $tsquery, $tsquery; } @@ -119,7 +123,7 @@ inner join rad_ustanova using (id) -- sifra warn "XXX SQL = ",$sql, dump( @exec ); - my $dbh = DBI->connect_cached("dbi:Pg:dbname=$dbname", '', '', {AutoCommit => 0}); + my $dbh = DBI->connect_cached("dbi:Pg:dbname=$dbname;host=$pg_host", $pg_user, $pg_passwd, {AutoCommit => 0}); my $sth = $dbh->prepare( $sql );