4 => '',
7 => '',
8 => '',
- 1003 => '',
+ 1003 => 'fti_au:',
# 16 => '',
21 => '',
12 => '',
die "need query" unless defined $query;
+ my $fti = $1 if $query =~ s/^(fti_\w\w)://;
+ $fti ||= 'fti_pr';
+
my $tsquery = join(' & ', split(/\s+/,$query) );
+ my $table = lc $self->{database};
+ $table =~ s/^crosbi-//g;
+
my $sql = qq{
select *
-from casopis
+from $table
inner join rad_ustanova using (id)
left outer join rad_napomena using (id)
left outer join rad_projekt using (id)
left outer join rad_godina using (id)
left outer join rad_podrucje using (id)
left outer join url using (id)
-where rad_ustanova.sifra = ? and (
- fti_au @@ to_tsquery(?)
- or fti_pr @@ to_tsquery(?)
-)
+where rad_ustanova.sifra = ?
+and $fti @@ to_tsquery(?)
};
my $dbh = DBI->connect_cached("dbi:Pg:dbname=$dbname", '', '', {AutoCommit => 0});
- my $sth = $dbh->prepare( $sql );
-
warn "XXX SQL = ",$sql;
-#-- and naslov like ?
+ my $sth = $dbh->prepare( $sql );
$sth->execute(
130, # FIXME ustanova
$tsquery,
- $tsquery,
-# , '%' . $query . '%'
);
$self->{_sth} = $sth;
'a' => $row->{title}
);
+ sub page_range {
+ my ( $prefix, $from, $to ) = @_;
+ my $out;
+ if ( $from ) {
+ $out = $prefix . $from;
+ $out .= '-' . $to if $to;
+ }
+ return $out;
+ }
+
$marc->add_fields(300,' ',' ',
- a => join('-', $row->{stranica_prva}, $row->{stranica_zadnja}),
+ a => page_range('',$row->{stranica_prva},$row->{stranica_zadnja}),
f => 'str.'
);
) foreach @a;
}
-
$marc->add_fields(773,'0',' ',
t => $row->{casopis},
x => $row->{issn},
- g => "$row->{volumen} ($row->{godina}), $row->{broj} ; str. " . join('-',$row->{stranica_prva}, $row->{stranica_zadnja}),
+ g => "$row->{volumen} ($row->{godina}), $row->{broj} ;" . page_range(' str. ',$row->{stranica_prva}, $row->{stranica_zadnja}),
);
if ( my $file = $row->{datoteka} ) {