@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+28 -1
+2
src/__phutil_library_map__.php
··· 1473 1473 'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php', 1474 1474 'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php', 1475 1475 'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php', 1476 + 'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php', 1476 1477 'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php', 1477 1478 'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php', 1478 1479 'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php', ··· 3609 3610 'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController', 3610 3611 'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 3611 3612 'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine', 3613 + 'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 3612 3614 'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator', 3613 3615 'PhabricatorProjectTransaction' => 'PhabricatorProjectDAO', 3614 3616 'PhabricatorProjectTransactionType' => 'PhabricatorProjectConstants',
+25
src/applications/project/search/PhabricatorProjectSearchIndexer.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectSearchIndexer 4 + extends PhabricatorSearchDocumentIndexer { 5 + 6 + public function getIndexableObject() { 7 + return new PhabricatorProject(); 8 + } 9 + 10 + protected function buildAbstractDocumentByPHID($phid) { 11 + $project = $this->loadDocumentByPHID($phid); 12 + 13 + $doc = new PhabricatorSearchAbstractDocument(); 14 + $doc->setPHID($project->getPHID()); 15 + $doc->setDocumentType(PhabricatorProjectPHIDTypeProject::TYPECONST); 16 + $doc->setDocumentTitle($project->getName()); 17 + $doc->setDocumentCreated($project->getDateCreated()); 18 + $doc->setDocumentModified($project->getDateModified()); 19 + 20 + // NOTE: This could be more full-featured, but for now we're mostly 21 + // interested in the side effects of indexing. 22 + 23 + return $doc; 24 + } 25 + }
+1 -1
src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
··· 124 124 $indexer_phid = $indexer->getIndexableObject()->generatePHID(); 125 125 $indexer_type = phid_get_type($indexer_phid); 126 126 127 - if ($type && ($indexer_type != $type)) { 127 + if ($type && strcasecmp($indexer_type, $type)) { 128 128 continue; 129 129 } 130 130