remove unecessary distinct from device searches, and fix bug in by_field
This commit is contained in:
@@ -123,7 +123,7 @@ sub search_by_field {
|
|||||||
|
|
||||||
# this is a bit of an inelegant trick to catch junk data entry,
|
# this is a bit of an inelegant trick to catch junk data entry,
|
||||||
# whilst avoiding returning *all* entries in the table
|
# whilst avoiding returning *all* entries in the table
|
||||||
if (exists $p->{ip} and defined $p->{ip} and 'NetAddr::IP::Lite' ne ref $p->{ip}) {
|
if (length $p->{ip} and 'NetAddr::IP::Lite' ne ref $p->{ip}) {
|
||||||
$p->{ip} = ( NetAddr::IP::Lite->new($p->{ip})
|
$p->{ip} = ( NetAddr::IP::Lite->new($p->{ip})
|
||||||
|| NetAddr::IP::Lite->new('255.255.255.255') );
|
|| NetAddr::IP::Lite->new('255.255.255.255') );
|
||||||
}
|
}
|
||||||
@@ -161,8 +161,7 @@ sub search_by_field {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
order_by => [qw/ me.dns me.ip /],
|
order_by => [qw/ me.dns me.ip /],
|
||||||
join => 'device_ips',
|
(($p->{dns} or $p->{ip}) ? (join => 'device_ips') : ()),
|
||||||
distinct => 1,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -234,7 +233,6 @@ sub search_fuzzy {
|
|||||||
{
|
{
|
||||||
order_by => [qw/ me.dns me.ip /],
|
order_by => [qw/ me.dns me.ip /],
|
||||||
join => 'device_ips',
|
join => 'device_ips',
|
||||||
distinct => 1,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user