mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
Index projects in the main search index
Summary: Part one of a large and complicated plot: - The last filter for Maniphest "pro" queries is "Group By". - This is currently executed in a convoluted and ridiculous way, loading massive amounts of data. - The primary reason it works like it does is that we don't have a project name index available in Maniphest, so we can't sort in the DB. - So, I want to provide a name index to Maniphest and push this work to the DB. To do that, my plan is: - Index projects in Search. - Add a "did update index" event. - Have Maniphest listen for it. - When projects are updated, update their indexes in Maniphest. - Rewrite the giant mess of "group by: project" to be somewhat reasonable. - This may also extend to some future "group by: assignee". This is the first small step down this path, which just indexes projects in search. Test Plan: Ran `bin/search index --type project`, then searched for projects. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6955
This commit is contained in:
parent
df86f87289
commit
e96201773d
3 changed files with 28 additions and 1 deletions
|
@ -1473,6 +1473,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php',
|
'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php',
|
||||||
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
||||||
'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php',
|
'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php',
|
||||||
|
'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php',
|
||||||
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
|
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
|
||||||
'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php',
|
'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php',
|
||||||
'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php',
|
'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php',
|
||||||
|
@ -3609,6 +3610,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController',
|
'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||||
'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
||||||
'PhabricatorProjectTransaction' => 'PhabricatorProjectDAO',
|
'PhabricatorProjectTransaction' => 'PhabricatorProjectDAO',
|
||||||
'PhabricatorProjectTransactionType' => 'PhabricatorProjectConstants',
|
'PhabricatorProjectTransactionType' => 'PhabricatorProjectConstants',
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorProjectSearchIndexer
|
||||||
|
extends PhabricatorSearchDocumentIndexer {
|
||||||
|
|
||||||
|
public function getIndexableObject() {
|
||||||
|
return new PhabricatorProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildAbstractDocumentByPHID($phid) {
|
||||||
|
$project = $this->loadDocumentByPHID($phid);
|
||||||
|
|
||||||
|
$doc = new PhabricatorSearchAbstractDocument();
|
||||||
|
$doc->setPHID($project->getPHID());
|
||||||
|
$doc->setDocumentType(PhabricatorProjectPHIDTypeProject::TYPECONST);
|
||||||
|
$doc->setDocumentTitle($project->getName());
|
||||||
|
$doc->setDocumentCreated($project->getDateCreated());
|
||||||
|
$doc->setDocumentModified($project->getDateModified());
|
||||||
|
|
||||||
|
// NOTE: This could be more full-featured, but for now we're mostly
|
||||||
|
// interested in the side effects of indexing.
|
||||||
|
|
||||||
|
return $doc;
|
||||||
|
}
|
||||||
|
}
|
|
@ -124,7 +124,7 @@ final class PhabricatorSearchManagementIndexWorkflow
|
||||||
$indexer_phid = $indexer->getIndexableObject()->generatePHID();
|
$indexer_phid = $indexer->getIndexableObject()->generatePHID();
|
||||||
$indexer_type = phid_get_type($indexer_phid);
|
$indexer_type = phid_get_type($indexer_phid);
|
||||||
|
|
||||||
if ($type && ($indexer_type != $type)) {
|
if ($type && strcasecmp($indexer_type, $type)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue