diff --git a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php index 41d5d6823a..720b4cc2ef 100644 --- a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php +++ b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php @@ -22,9 +22,18 @@ final class PhabricatorOwnersPackageDatasource $results = array(); $query = id(new PhabricatorOwnersPackageQuery()) - ->withNameNgrams($raw_query) ->setOrder('name'); + // If the user is querying by monogram explicitly, like "O123", do an ID + // search. Otherwise, do an ngram substring search. + if (preg_match('/^[oO]\d+\z/', $raw_query)) { + $id = trim($raw_query, 'oO'); + $id = (int)$id; + $query->withIDs(array($id)); + } else { + $query->withNameNgrams($raw_query); + } + $packages = $this->executeQuery($query); foreach ($packages as $package) { $name = $package->getName();