diff --git a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php index 7630e0162..da46f8bf9 100644 --- a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php +++ b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php @@ -260,10 +260,9 @@ protected function fetchColumnSuggestions($searchTerm) protected function matchSuggestion($path, $label, $searchTerm) { - if (preg_match('/[_.](id|bin|checksum)$/', $path)) { - // Only suggest exotic columns if the user knows about them - $trimmedSearch = trim($searchTerm, ' *'); - return substr($path, -strlen($trimmedSearch)) === $trimmedSearch; + if (preg_match('/[_.](id|bin|checksum)$/', $path, $matches)) { + // Only suggest exotic columns if the user knows the full column path + return substr($path, strrpos($path, '.') + 1) === trim($searchTerm, ' *'); } return parent::matchSuggestion($path, $label, $searchTerm);