Revert "new port-search wildcarding - bad idea?"

This reverts commit 947614ddd8.
This commit is contained in:
Oliver Gorwits
2013-09-10 23:24:12 +01:00
parent 40eeec80ab
commit 282e2d9c7c
9 changed files with 14 additions and 24 deletions

View File

@@ -31,19 +31,9 @@ ajax '/ajax/content/device/ports' => require_login sub {
return unless $set->count;
}
else {
# Google-style search. Quoted means exact, otherwise wildcard.
# but still supoort manual wildcarding.
if ($f =~ m/^['"]/ and $f =~ m/['"]$/) {
$f =~ s/^['"]//;
$f =~ s/['"]$//;
}
else {
$f =~ s/\*/%/g;
$f =~ s/\?/_/g;
$f =~ s/^\%*/%/;
$f =~ s/\%*$/%/;
$f = { '-ilike' => $f };
}
$f =~ s/\*/%/g if index($f, '*') >= 0;
$f =~ s/\?/_/g if index($f, '?') >= 0;
$f = { '-ilike' => $f };
if ($set->search({'me.port' => $f})->count) {
$set = $set->search({'me.port' => $f});