Index all repository URIs, not just the "primary" repository URI

Summary:
Ref T10923. When regenerating the URI index for a repository, index every URI.

  - Also, make the index slightly stricter (domain + path instead of just path). Excluding the domain made more sense when we were generating only first-party URIs.
  - Make the index smarter about `/diffusion/123/` URIs.
  - Show normalized URIs in `diffusion.repository.search` results.

Test Plan:
  - Ran migration.
  - Verified sensible-looking results in database.
  - Searched for a repository URI by first-party clone URI.
  - Searched for a repository URI by mirror URI.
  - Used `diffusion.repository.search` to get information about repository URIs.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10923

Differential Revision: https://secure.phabricator.com/D15876
This commit is contained in:
epriestley
2016-05-10 06:20:48 -07:00
parent f05fce44aa
commit 576b73dc53
7 changed files with 93 additions and 44 deletions

View File

@@ -38,6 +38,11 @@ final class PhabricatorRepositorySearchEngine
->setLabel(pht('Types'))
->setKey('types')
->setOptions(PhabricatorRepositoryType::getAllRepositoryTypes()),
id(new PhabricatorSearchStringListField())
->setLabel(pht('URIs'))
->setKey('uris')
->setDescription(
pht('Search for repositories by clone/checkout URI.')),
);
}
@@ -70,6 +75,10 @@ final class PhabricatorRepositorySearchEngine
$query->withNameContains($map['name']);
}
if ($map['uris']) {
$query->withURIs($map['uris']);
}
return $query;
}