Skip to content

Commit

Permalink
ObjectSuggestions: Fix exotic columns match
Browse files Browse the repository at this point in the history
These columns should only be shown if expicitely given by user.
Previously, columns with a similar suffix were also found, e.g. the search for `id` also showed `uuid` as search suggestion.
  • Loading branch information
sukhwinder33445 committed Jul 22, 2024
1 parent b377ae1 commit 9d89dec
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,8 @@ protected function queryTags(Model $model, string $searchTerm): Query
protected function matchSuggestion($path, $label, $searchTerm)
{
if (preg_match('/[_.](id)$/', $path)) {
// Only suggest exotic columns if the user knows about them
$trimmedSearch = trim($searchTerm, ' *');
return substr($path, -strlen($trimmedSearch)) === $trimmedSearch;
// 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);
Expand Down

0 comments on commit 9d89dec

Please sign in to comment.