projects
/
Biblio-Z3950.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
we need english stemmer because remote database is configured wrong
[Biblio-Z3950.git]
/
CROSBI.pm
diff --git
a/CROSBI.pm
b/CROSBI.pm
index
c78c9d8
..
62ae19f
100644
(file)
--- a/
CROSBI.pm
+++ b/
CROSBI.pm
@@
-8,6
+8,7
@@
use Data::Dump qw/dump/;
use DBI;
use utf8;
use DBI;
use utf8;
+use Scraper;
use base 'Scraper';
my $debug = $ENV{DEBUG} || 0;
use base 'Scraper';
my $debug = $ENV{DEBUG} || 0;
@@
-47,6
+48,9
@@
sub usemap {{
=cut
my $dbname = 'bibliografija';
=cut
my $dbname = 'bibliografija';
+my $pg_user = $ENV{PGUSER} || '';
+my $pg_passwd = $ENV{PGPASSWD} || '';
+my $pg_host = $ENV{PGHOST} || '';
my @and;
my @exec;
my @and;
my @exec;
@@
-96,7
+100,7
@@
inner join rad_ustanova using (id) -- sifra
my @or;
foreach my $f ( split(/,/,$fti) ) {
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) . ")";
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) );
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;
}
push @exec, $tsquery, $tsquery;
}
@@
-119,7
+123,7
@@
inner join rad_ustanova using (id) -- sifra
warn "XXX SQL = ",$sql, dump( @exec );
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 );
my $sth = $dbh->prepare( $sql );