summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Releases.pm2
-rw-r--r--lib/VNDB/DB/VN.pm7
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm
index bc64b880..9491d213 100644
--- a/lib/VNDB/DB/Releases.pm
+++ b/lib/VNDB/DB/Releases.pm
@@ -51,7 +51,7 @@ sub dbReleaseGet {
s/%//g;
if(/^\d+$/ && gtintype($_)) {
push @where, 'rr.gtin = ?', $_;
- } else {
+ } elsif(length($_) > 0) {
$_ = "%$_%";
push @where, '(rr.title ILIKE ? OR rr.original ILIKE ? OR rr.catalog = ?)',
[ $_, $_, $_ ];
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index 54e2f510..4798e16f 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -50,19 +50,18 @@ sub dbVNGet {
);
if($o{search}) {
- my @w = (
- '(irr.id IS NULL OR ir.latest = irr.id)' => 1
- );
+ my @w;
for (split /[ -,._]/, $o{search}) {
s/%//g;
if(/^\d+$/ && gtintype($_)) {
push @w, 'irr.gtin = ?', $_;
- } else {
+ } elsif(length($_) > 0) {
$_ = "%$_%";
push @w, '(ivr.title ILIKE ? OR ivr.original ILIKE ? OR ivr.alias ILIKE ? OR irr.title ILIKE ? OR irr.original ILIKE ?)',
[ $_, $_, $_, $_, $_ ];
}
}
+ push @w, '(irr.id IS NULL OR ir.latest = irr.id)' => 1 if @w;
$where{ q|
v.id IN(SELECT iv.id
FROM vn iv