I've created a very small function (not the most optimal, though) that improves the filter a bit.
I tested it under "List view' and 'Preview view'.
If you wish to add it to Cacti, no problem at all...
The code for this function is:
Code: Select all
function parse_filter($field, $filter) {
if (!$filter) {
return " " . $field . " like '%%%%'";
}
$farray = preg_split("/ /", $filter, -1, PREG_SPLIT_NO_EMPTY);
if (sizeof($farray) == 0) {
return " " . $field . " like '%%%%'";
}
$nfilter = "(";
while (sizeof($farray) != 0) {
$nfilter .= " " . $field . " like '%%" . array_shift($farray) . "%%'";
if (sizeof($farray) != 0) {
$nfilter .= " and ";
}
}
$nfilter .= ")";
return $nfilter;
}
From:
Code: Select all
and graph_templates_graph.title_cache like '%%" . $_REQUEST["filter"] . "%%'
Code: Select all
and " . parse_filter("graph_templates_graph.title_cache", $_REQUEST["filter"]) . "