mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 03:20:59 +01:00
Add basic search capabilities to Packages
Summary: Ref T8116. Add search-by-name and per-package / per-publisher search to Packages. Test Plan: Searched publishers, packages, versions by name. Searched packages by publisher. Searched versions by package. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8116 Differential Revision: https://secure.phabricator.com/D16320
This commit is contained in:
parent
f5d2f8e07a
commit
08a19f35f0
22 changed files with 212 additions and 32 deletions
7
resources/sql/autopatches/20160722.pack.01.pubngrams.sql
Normal file
7
resources/sql/autopatches/20160722.pack.01.pubngrams.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_packages.packages_publishername_ngrams (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
objectID INT UNSIGNED NOT NULL,
|
||||||
|
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT},
|
||||||
|
KEY `key_object` (objectID),
|
||||||
|
KEY `key_ngram` (ngram, objectID)
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
7
resources/sql/autopatches/20160722.pack.02.pkgngrams.sql
Normal file
7
resources/sql/autopatches/20160722.pack.02.pkgngrams.sql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_packages.packages_packagename_ngrams (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
objectID INT UNSIGNED NOT NULL,
|
||||||
|
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT},
|
||||||
|
KEY `key_object` (objectID),
|
||||||
|
KEY `key_ngram` (ngram, objectID)
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -0,0 +1,7 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_packages.packages_versionname_ngrams (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
objectID INT UNSIGNED NOT NULL,
|
||||||
|
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT},
|
||||||
|
KEY `key_object` (objectID),
|
||||||
|
KEY `key_ngram` (ngram, objectID)
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -2978,6 +2978,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesDAO' => 'applications/packages/storage/PhabricatorPackagesDAO.php',
|
'PhabricatorPackagesDAO' => 'applications/packages/storage/PhabricatorPackagesDAO.php',
|
||||||
'PhabricatorPackagesEditEngine' => 'applications/packages/editor/PhabricatorPackagesEditEngine.php',
|
'PhabricatorPackagesEditEngine' => 'applications/packages/editor/PhabricatorPackagesEditEngine.php',
|
||||||
'PhabricatorPackagesEditor' => 'applications/packages/editor/PhabricatorPackagesEditor.php',
|
'PhabricatorPackagesEditor' => 'applications/packages/editor/PhabricatorPackagesEditor.php',
|
||||||
|
'PhabricatorPackagesNgrams' => 'applications/packages/storage/PhabricatorPackagesNgrams.php',
|
||||||
'PhabricatorPackagesPackage' => 'applications/packages/storage/PhabricatorPackagesPackage.php',
|
'PhabricatorPackagesPackage' => 'applications/packages/storage/PhabricatorPackagesPackage.php',
|
||||||
'PhabricatorPackagesPackageController' => 'applications/packages/controller/PhabricatorPackagesPackageController.php',
|
'PhabricatorPackagesPackageController' => 'applications/packages/controller/PhabricatorPackagesPackageController.php',
|
||||||
'PhabricatorPackagesPackageDatasource' => 'applications/packages/typeahead/PhabricatorPackagesPackageDatasource.php',
|
'PhabricatorPackagesPackageDatasource' => 'applications/packages/typeahead/PhabricatorPackagesPackageDatasource.php',
|
||||||
|
@ -2989,6 +2990,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPackageEditor' => 'applications/packages/editor/PhabricatorPackagesPackageEditor.php',
|
'PhabricatorPackagesPackageEditor' => 'applications/packages/editor/PhabricatorPackagesPackageEditor.php',
|
||||||
'PhabricatorPackagesPackageKeyTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageKeyTransaction.php',
|
'PhabricatorPackagesPackageKeyTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageKeyTransaction.php',
|
||||||
'PhabricatorPackagesPackageListController' => 'applications/packages/controller/PhabricatorPackagesPackageListController.php',
|
'PhabricatorPackagesPackageListController' => 'applications/packages/controller/PhabricatorPackagesPackageListController.php',
|
||||||
|
'PhabricatorPackagesPackageNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPackageNameNgrams.php',
|
||||||
'PhabricatorPackagesPackageNameTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageNameTransaction.php',
|
'PhabricatorPackagesPackageNameTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageNameTransaction.php',
|
||||||
'PhabricatorPackagesPackagePHIDType' => 'applications/packages/phid/PhabricatorPackagesPackagePHIDType.php',
|
'PhabricatorPackagesPackagePHIDType' => 'applications/packages/phid/PhabricatorPackagesPackagePHIDType.php',
|
||||||
'PhabricatorPackagesPackagePublisherTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackagePublisherTransaction.php',
|
'PhabricatorPackagesPackagePublisherTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackagePublisherTransaction.php',
|
||||||
|
@ -3009,6 +3011,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPublisherEditor' => 'applications/packages/editor/PhabricatorPackagesPublisherEditor.php',
|
'PhabricatorPackagesPublisherEditor' => 'applications/packages/editor/PhabricatorPackagesPublisherEditor.php',
|
||||||
'PhabricatorPackagesPublisherKeyTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherKeyTransaction.php',
|
'PhabricatorPackagesPublisherKeyTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherKeyTransaction.php',
|
||||||
'PhabricatorPackagesPublisherListController' => 'applications/packages/controller/PhabricatorPackagesPublisherListController.php',
|
'PhabricatorPackagesPublisherListController' => 'applications/packages/controller/PhabricatorPackagesPublisherListController.php',
|
||||||
|
'PhabricatorPackagesPublisherNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPublisherNameNgrams.php',
|
||||||
'PhabricatorPackagesPublisherNameTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherNameTransaction.php',
|
'PhabricatorPackagesPublisherNameTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherNameTransaction.php',
|
||||||
'PhabricatorPackagesPublisherPHIDType' => 'applications/packages/phid/PhabricatorPackagesPublisherPHIDType.php',
|
'PhabricatorPackagesPublisherPHIDType' => 'applications/packages/phid/PhabricatorPackagesPublisherPHIDType.php',
|
||||||
'PhabricatorPackagesPublisherQuery' => 'applications/packages/query/PhabricatorPackagesPublisherQuery.php',
|
'PhabricatorPackagesPublisherQuery' => 'applications/packages/query/PhabricatorPackagesPublisherQuery.php',
|
||||||
|
@ -3028,6 +3031,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesVersionEditEngine' => 'applications/packages/editor/PhabricatorPackagesVersionEditEngine.php',
|
'PhabricatorPackagesVersionEditEngine' => 'applications/packages/editor/PhabricatorPackagesVersionEditEngine.php',
|
||||||
'PhabricatorPackagesVersionEditor' => 'applications/packages/editor/PhabricatorPackagesVersionEditor.php',
|
'PhabricatorPackagesVersionEditor' => 'applications/packages/editor/PhabricatorPackagesVersionEditor.php',
|
||||||
'PhabricatorPackagesVersionListController' => 'applications/packages/controller/PhabricatorPackagesVersionListController.php',
|
'PhabricatorPackagesVersionListController' => 'applications/packages/controller/PhabricatorPackagesVersionListController.php',
|
||||||
|
'PhabricatorPackagesVersionNameNgrams' => 'applications/packages/storage/PhabricatorPackagesVersionNameNgrams.php',
|
||||||
'PhabricatorPackagesVersionNameTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionNameTransaction.php',
|
'PhabricatorPackagesVersionNameTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionNameTransaction.php',
|
||||||
'PhabricatorPackagesVersionPHIDType' => 'applications/packages/phid/PhabricatorPackagesVersionPHIDType.php',
|
'PhabricatorPackagesVersionPHIDType' => 'applications/packages/phid/PhabricatorPackagesVersionPHIDType.php',
|
||||||
'PhabricatorPackagesVersionPackageTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionPackageTransaction.php',
|
'PhabricatorPackagesVersionPackageTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionPackageTransaction.php',
|
||||||
|
@ -7797,6 +7801,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorPackagesDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorPackagesEditEngine' => 'PhabricatorEditEngine',
|
'PhabricatorPackagesEditEngine' => 'PhabricatorEditEngine',
|
||||||
'PhabricatorPackagesEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhabricatorPackagesEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
|
'PhabricatorPackagesNgrams' => 'PhabricatorSearchNgrams',
|
||||||
'PhabricatorPackagesPackage' => array(
|
'PhabricatorPackagesPackage' => array(
|
||||||
'PhabricatorPackagesDAO',
|
'PhabricatorPackagesDAO',
|
||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
|
@ -7805,6 +7810,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSubscribableInterface',
|
'PhabricatorSubscribableInterface',
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorConduitResultInterface',
|
'PhabricatorConduitResultInterface',
|
||||||
|
'PhabricatorNgramsInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorPackagesPackageController' => 'PhabricatorPackagesController',
|
'PhabricatorPackagesPackageController' => 'PhabricatorPackagesController',
|
||||||
'PhabricatorPackagesPackageDatasource' => 'PhabricatorTypeaheadDatasource',
|
'PhabricatorPackagesPackageDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
|
@ -7816,6 +7822,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPackageEditor' => 'PhabricatorPackagesEditor',
|
'PhabricatorPackagesPackageEditor' => 'PhabricatorPackagesEditor',
|
||||||
'PhabricatorPackagesPackageKeyTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
'PhabricatorPackagesPackageKeyTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
||||||
'PhabricatorPackagesPackageListController' => 'PhabricatorPackagesPackageController',
|
'PhabricatorPackagesPackageListController' => 'PhabricatorPackagesPackageController',
|
||||||
|
'PhabricatorPackagesPackageNameNgrams' => 'PhabricatorPackagesNgrams',
|
||||||
'PhabricatorPackagesPackageNameTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
'PhabricatorPackagesPackageNameTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
||||||
'PhabricatorPackagesPackagePHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorPackagesPackagePHIDType' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorPackagesPackagePublisherTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
'PhabricatorPackagesPackagePublisherTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
||||||
|
@ -7834,6 +7841,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSubscribableInterface',
|
'PhabricatorSubscribableInterface',
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorConduitResultInterface',
|
'PhabricatorConduitResultInterface',
|
||||||
|
'PhabricatorNgramsInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorPackagesPublisherController' => 'PhabricatorPackagesController',
|
'PhabricatorPackagesPublisherController' => 'PhabricatorPackagesController',
|
||||||
'PhabricatorPackagesPublisherDatasource' => 'PhabricatorTypeaheadDatasource',
|
'PhabricatorPackagesPublisherDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
|
@ -7844,6 +7852,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPublisherEditor' => 'PhabricatorPackagesEditor',
|
'PhabricatorPackagesPublisherEditor' => 'PhabricatorPackagesEditor',
|
||||||
'PhabricatorPackagesPublisherKeyTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
'PhabricatorPackagesPublisherKeyTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
||||||
'PhabricatorPackagesPublisherListController' => 'PhabricatorPackagesPublisherController',
|
'PhabricatorPackagesPublisherListController' => 'PhabricatorPackagesPublisherController',
|
||||||
|
'PhabricatorPackagesPublisherNameNgrams' => 'PhabricatorPackagesNgrams',
|
||||||
'PhabricatorPackagesPublisherNameTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
'PhabricatorPackagesPublisherNameTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
||||||
'PhabricatorPackagesPublisherPHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorPackagesPublisherPHIDType' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorPackagesPublisherQuery' => 'PhabricatorPackagesQuery',
|
'PhabricatorPackagesPublisherQuery' => 'PhabricatorPackagesQuery',
|
||||||
|
@ -7865,6 +7874,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSubscribableInterface',
|
'PhabricatorSubscribableInterface',
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorConduitResultInterface',
|
'PhabricatorConduitResultInterface',
|
||||||
|
'PhabricatorNgramsInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorPackagesVersionController' => 'PhabricatorPackagesController',
|
'PhabricatorPackagesVersionController' => 'PhabricatorPackagesController',
|
||||||
'PhabricatorPackagesVersionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
'PhabricatorPackagesVersionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
||||||
|
@ -7872,6 +7882,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesVersionEditEngine' => 'PhabricatorPackagesEditEngine',
|
'PhabricatorPackagesVersionEditEngine' => 'PhabricatorPackagesEditEngine',
|
||||||
'PhabricatorPackagesVersionEditor' => 'PhabricatorPackagesEditor',
|
'PhabricatorPackagesVersionEditor' => 'PhabricatorPackagesEditor',
|
||||||
'PhabricatorPackagesVersionListController' => 'PhabricatorPackagesVersionController',
|
'PhabricatorPackagesVersionListController' => 'PhabricatorPackagesVersionController',
|
||||||
|
'PhabricatorPackagesVersionNameNgrams' => 'PhabricatorPackagesNgrams',
|
||||||
'PhabricatorPackagesVersionNameTransaction' => 'PhabricatorPackagesVersionTransactionType',
|
'PhabricatorPackagesVersionNameTransaction' => 'PhabricatorPackagesVersionTransactionType',
|
||||||
'PhabricatorPackagesVersionPHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorPackagesVersionPHIDType' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorPackagesVersionPackageTransaction' => 'PhabricatorPackagesVersionTransactionType',
|
'PhabricatorPackagesVersionPackageTransaction' => 'PhabricatorPackagesVersionTransactionType',
|
||||||
|
|
|
@ -7,4 +7,14 @@ abstract class PhabricatorPackagesEditor
|
||||||
return 'PhabricatorPasteApplication';
|
return 'PhabricatorPasteApplication';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function supportsSearch() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function shouldPublishFeedStory(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,6 @@ final class PhabricatorPackagesPackageEditor
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function shouldPublishFeedStory(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,6 @@ final class PhabricatorPackagesPublisherEditor
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function shouldPublishFeedStory(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,6 @@ final class PhabricatorPackagesVersionEditor
|
||||||
return pht('%s created %s.', $author, $object);
|
return pht('%s created %s.', $author, $object);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function shouldPublishFeedStory(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,12 @@ final class PhabricatorPackagesPackageQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withNameNgrams($ngrams) {
|
||||||
|
return $this->withNgramsConstraint(
|
||||||
|
new PhabricatorPackagesPackageNameNgrams(),
|
||||||
|
$ngrams);
|
||||||
|
}
|
||||||
|
|
||||||
public function newResultObject() {
|
public function newResultObject() {
|
||||||
return new PhabricatorPackagesPackage();
|
return new PhabricatorPackagesPackage();
|
||||||
}
|
}
|
||||||
|
@ -62,7 +68,7 @@ final class PhabricatorPackagesPackageQuery
|
||||||
if ($this->publisherPHIDs !== null) {
|
if ($this->publisherPHIDs !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'p.phid IN (%Ls)',
|
'p.publisherPHID IN (%Ls)',
|
||||||
$this->publisherPHIDs);
|
$this->publisherPHIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,30 @@ final class PhabricatorPackagesPackageSearchEngine
|
||||||
protected function buildQueryFromParameters(array $map) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = $this->newQuery();
|
$query = $this->newQuery();
|
||||||
|
|
||||||
|
if ($map['match'] !== null) {
|
||||||
|
$query->withNameNgrams($map['match']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($map['publisherPHIDs']) {
|
||||||
|
$query->withPublisherPHIDs($map['publisherPHIDs']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
return array();
|
return array(
|
||||||
|
id(new PhabricatorSearchTextField())
|
||||||
|
->setLabel(pht('Name Contains'))
|
||||||
|
->setKey('match')
|
||||||
|
->setDescription(pht('Search for packages by name substring.')),
|
||||||
|
id(new PhabricatorSearchDatasourceField())
|
||||||
|
->setLabel(pht('Publishers'))
|
||||||
|
->setKey('publisherPHIDs')
|
||||||
|
->setAliases(array('publisherPHID', 'publisher', 'publishers'))
|
||||||
|
->setDatasource(new PhabricatorPackagesPublisherDatasource())
|
||||||
|
->setDescription(pht('Search for packages by publisher.')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
|
|
|
@ -22,6 +22,12 @@ final class PhabricatorPackagesPublisherQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withNameNgrams($ngrams) {
|
||||||
|
return $this->withNgramsConstraint(
|
||||||
|
new PhabricatorPackagesPublisherNameNgrams(),
|
||||||
|
$ngrams);
|
||||||
|
}
|
||||||
|
|
||||||
public function newResultObject() {
|
public function newResultObject() {
|
||||||
return new PhabricatorPackagesPublisher();
|
return new PhabricatorPackagesPublisher();
|
||||||
}
|
}
|
||||||
|
@ -36,25 +42,29 @@ final class PhabricatorPackagesPublisherQuery
|
||||||
if ($this->ids !== null) {
|
if ($this->ids !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'id IN (%Ld)',
|
'u.id IN (%Ld)',
|
||||||
$this->ids);
|
$this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->phids !== null) {
|
if ($this->phids !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'phid IN (%Ls)',
|
'u.phid IN (%Ls)',
|
||||||
$this->phids);
|
$this->phids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->publisherKeys !== null) {
|
if ($this->publisherKeys !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'publisherKey IN (%Ls)',
|
'u.publisherKey IN (%Ls)',
|
||||||
$this->publisherKeys);
|
$this->publisherKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $where;
|
return $where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getPrimaryTableAlias() {
|
||||||
|
return 'u';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,20 @@ final class PhabricatorPackagesPublisherSearchEngine
|
||||||
protected function buildQueryFromParameters(array $map) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = $this->newQuery();
|
$query = $this->newQuery();
|
||||||
|
|
||||||
|
if ($map['match'] !== null) {
|
||||||
|
$query->withNameNgrams($map['match']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
return array();
|
return array(
|
||||||
|
id(new PhabricatorSearchTextField())
|
||||||
|
->setLabel(pht('Name Contains'))
|
||||||
|
->setKey('match')
|
||||||
|
->setDescription(pht('Search for publishers by name substring.')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
|
|
|
@ -34,6 +34,12 @@ final class PhabricatorPackagesVersionQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withNameNgrams($ngrams) {
|
||||||
|
return $this->withNgramsConstraint(
|
||||||
|
new PhabricatorPackagesVersionNameNgrams(),
|
||||||
|
$ngrams);
|
||||||
|
}
|
||||||
|
|
||||||
public function newResultObject() {
|
public function newResultObject() {
|
||||||
return new PhabricatorPackagesVersion();
|
return new PhabricatorPackagesVersion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,31 @@ final class PhabricatorPackagesVersionSearchEngine
|
||||||
protected function buildQueryFromParameters(array $map) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = $this->newQuery();
|
$query = $this->newQuery();
|
||||||
|
|
||||||
|
if ($map['match'] !== null) {
|
||||||
|
$query->withNameNgrams($map['match']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($map['packagePHIDs']) {
|
||||||
|
$query->withPackagePHIDs($map['packagePHIDs']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
return array();
|
return array(
|
||||||
|
id(new PhabricatorSearchTextField())
|
||||||
|
->setLabel(pht('Name Contains'))
|
||||||
|
->setKey('match')
|
||||||
|
->setDescription(pht('Search for versions by name substring.')),
|
||||||
|
id(new PhabricatorSearchDatasourceField())
|
||||||
|
->setLabel(pht('Packages'))
|
||||||
|
->setKey('packagePHIDs')
|
||||||
|
->setAliases(array('packagePHID', 'package', 'packages'))
|
||||||
|
->setDatasource(new PhabricatorPackagesPackageDatasource())
|
||||||
|
->setDescription(pht('Search for versions by package.')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
return '/packages/version/'.$path;
|
return '/packages/version/'.$path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class PhabricatorPackagesNgrams
|
||||||
|
extends PhabricatorSearchNgrams {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'packages';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ final class PhabricatorPackagesPackage
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorSubscribableInterface,
|
PhabricatorSubscribableInterface,
|
||||||
PhabricatorProjectInterface,
|
PhabricatorProjectInterface,
|
||||||
PhabricatorConduitResultInterface {
|
PhabricatorConduitResultInterface,
|
||||||
|
PhabricatorNgramsInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $publisherPHID;
|
protected $publisherPHID;
|
||||||
|
@ -39,7 +40,7 @@ final class PhabricatorPackagesPackage
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_AUX_PHID => true,
|
self::CONFIG_AUX_PHID => true,
|
||||||
self::CONFIG_COLUMN_SCHEMA => array(
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
'name' => 'text64',
|
'name' => 'sort64',
|
||||||
'packageKey' => 'sort64',
|
'packageKey' => 'sort64',
|
||||||
),
|
),
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
@ -207,6 +208,17 @@ final class PhabricatorPackagesPackage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorNgramsInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function newNgrams() {
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorPackagesPackageNameNgrams())
|
||||||
|
->setValue($this->getName()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPackagesPackageNameNgrams
|
||||||
|
extends PhabricatorPackagesNgrams {
|
||||||
|
|
||||||
|
public function getNgramKey() {
|
||||||
|
return 'packagename';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColumnName() {
|
||||||
|
return 'name';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ final class PhabricatorPackagesPublisher
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorSubscribableInterface,
|
PhabricatorSubscribableInterface,
|
||||||
PhabricatorProjectInterface,
|
PhabricatorProjectInterface,
|
||||||
PhabricatorConduitResultInterface {
|
PhabricatorConduitResultInterface,
|
||||||
|
PhabricatorNgramsInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $publisherKey;
|
protected $publisherKey;
|
||||||
|
@ -31,7 +32,7 @@ final class PhabricatorPackagesPublisher
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_AUX_PHID => true,
|
self::CONFIG_AUX_PHID => true,
|
||||||
self::CONFIG_COLUMN_SCHEMA => array(
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
'name' => 'text64',
|
'name' => 'sort64',
|
||||||
'publisherKey' => 'sort64',
|
'publisherKey' => 'sort64',
|
||||||
),
|
),
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
@ -183,6 +184,17 @@ final class PhabricatorPackagesPublisher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorNgramsInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function newNgrams() {
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorPackagesPublisherNameNgrams())
|
||||||
|
->setValue($this->getName()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPackagesPublisherNameNgrams
|
||||||
|
extends PhabricatorPackagesNgrams {
|
||||||
|
|
||||||
|
public function getNgramKey() {
|
||||||
|
return 'publishername';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColumnName() {
|
||||||
|
return 'name';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,7 +9,8 @@ final class PhabricatorPackagesVersion
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorSubscribableInterface,
|
PhabricatorSubscribableInterface,
|
||||||
PhabricatorProjectInterface,
|
PhabricatorProjectInterface,
|
||||||
PhabricatorConduitResultInterface {
|
PhabricatorConduitResultInterface,
|
||||||
|
PhabricatorNgramsInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $packagePHID;
|
protected $packagePHID;
|
||||||
|
@ -174,6 +175,17 @@ final class PhabricatorPackagesVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorNgramsInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function newNgrams() {
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorPackagesVersionNameNgrams())
|
||||||
|
->setValue($this->getName()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPackagesVersionNameNgrams
|
||||||
|
extends PhabricatorPackagesNgrams {
|
||||||
|
|
||||||
|
public function getNgramKey() {
|
||||||
|
return 'versionname';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColumnName() {
|
||||||
|
return 'name';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ final class PhabricatorPackagesPackageDatasource
|
||||||
extends PhabricatorTypeaheadDatasource {
|
extends PhabricatorTypeaheadDatasource {
|
||||||
|
|
||||||
public function getBrowseTitle() {
|
public function getBrowseTitle() {
|
||||||
return pht('Browse Packagess');
|
return pht('Browse Packages');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPlaceholderText() {
|
public function getPlaceholderText() {
|
||||||
|
|
Loading…
Reference in a new issue