@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 "Closed" and "Unowned" relationships explicitly

Summary: Ref T4365. Two diffs from now, I'm changing the UI a bit to let you search for closed and unowned documents more explcitly. To support this in ElasticSearch and more easily in MySQL search, make these explicit, positive relationships.

Test Plan: `bin/search index --all`

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4365

Differential Revision: https://secure.phabricator.com/D8122

+47 -38
+20 -11
src/applications/differential/search/DifferentialSearchIndexer.php
··· 44 44 PhabricatorPeoplePHIDTypeUser::TYPECONST, 45 45 $rev->getDateCreated()); 46 46 47 - if (!$rev->isClosed()) { 48 - $doc->addRelationship( 49 - PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 50 - $rev->getPHID(), 51 - DifferentialPHIDTypeRevision::TYPECONST, 52 - time()); 53 - } 47 + $doc->addRelationship( 48 + $rev->isClosed() 49 + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED 50 + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 51 + $rev->getPHID(), 52 + DifferentialPHIDTypeRevision::TYPECONST, 53 + time()); 54 54 55 55 $comments = id(new DifferentialCommentQuery()) 56 56 ->withRevisionIDs(array($rev->getID())) ··· 74 74 // If a revision needs review, the owners are the reviewers. Otherwise, the 75 75 // owner is the author (e.g., accepted, rejected, closed). 76 76 if ($rev->getStatus() == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) { 77 - foreach ($rev->getReviewers() as $phid) { 77 + $reviewers = $rev->getReviewers(); 78 + if ($reviewers) { 79 + foreach ($reviewers as $phid) { 80 + $doc->addRelationship( 81 + PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 82 + $phid, 83 + PhabricatorPeoplePHIDTypeUser::TYPECONST, 84 + $rev->getDateModified()); // Bogus timestamp. 85 + } 86 + } else { 78 87 $doc->addRelationship( 79 - PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 80 - $phid, 88 + PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, 89 + $rev->getPHID(), 81 90 PhabricatorPeoplePHIDTypeUser::TYPECONST, 82 91 $rev->getDateModified()); // Bogus timestamp. 83 92 } ··· 85 94 $doc->addRelationship( 86 95 PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 87 96 $rev->getAuthorPHID(), 88 - PhabricatorPeoplePHIDTypeUser::TYPECONST, 97 + PhabricatorPHIDConstants::PHID_TYPE_VOID, 89 98 $rev->getDateCreated()); 90 99 } 91 100
+11 -13
src/applications/maniphest/search/ManiphestSearchIndexer.php
··· 30 30 PhabricatorPeoplePHIDTypeUser::TYPECONST, 31 31 $task->getDateCreated()); 32 32 33 - if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) { 34 - $doc->addRelationship( 35 - PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 36 - $task->getPHID(), 37 - ManiphestPHIDTypeTask::TYPECONST, 38 - time()); 39 - } 33 + $doc->addRelationship( 34 + ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) 35 + ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN 36 + : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, 37 + $task->getPHID(), 38 + ManiphestPHIDTypeTask::TYPECONST, 39 + time()); 40 40 41 41 $this->indexTransactions( 42 42 $doc, ··· 60 60 time()); 61 61 } else { 62 62 $doc->addRelationship( 63 - PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 64 - ManiphestTaskOwner::OWNER_UP_FOR_GRABS, 65 - PhabricatorPHIDConstants::PHID_TYPE_MAGIC, 66 - $owner 67 - ? $owner->getDateCreated() 68 - : $task->getDateCreated()); 63 + PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, 64 + $task->getPHID(), 65 + PhabricatorPHIDConstants::PHID_TYPE_VOID, 66 + $task->getDateCreated()); 69 67 } 70 68 71 69 // We need to load handles here since non-users may subscribe (mailing
+7 -7
src/applications/people/search/PhabricatorUserSearchIndexer.php
··· 20 20 // TODO: Index the blurbs from their profile or something? Probably not 21 21 // actually useful... 22 22 23 - if ($user->isUserActivated()) { 24 - $doc->addRelationship( 25 - PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 26 - $user->getPHID(), 27 - PhabricatorPeoplePHIDTypeUser::TYPECONST, 28 - time()); 29 - } 23 + $doc->addRelationship( 24 + $user->isUserActivated() 25 + ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN 26 + : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, 27 + $user->getPHID(), 28 + PhabricatorPeoplePHIDTypeUser::TYPECONST, 29 + time()); 30 30 31 31 return $doc; 32 32 }
+7 -7
src/applications/phriction/search/PhrictionSearchIndexer.php
··· 37 37 PhabricatorPeoplePHIDTypeUser::TYPECONST, 38 38 $content->getDateCreated()); 39 39 40 - if ($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) { 41 - $doc->addRelationship( 42 - PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 43 - $document->getPHID(), 44 - PhrictionPHIDTypeDocument::TYPECONST, 45 - time()); 46 - } 40 + $doc->addRelationship( 41 + ($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) 42 + ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN 43 + : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, 44 + $document->getPHID(), 45 + PhrictionPHIDTypeDocument::TYPECONST, 46 + time()); 47 47 48 48 return $doc; 49 49 }
+2
src/applications/search/constants/PhabricatorSearchRelationship.php
··· 14 14 const RELATIONSHIP_REPOSITORY = 'repo'; 15 15 16 16 const RELATIONSHIP_OPEN = 'open'; 17 + const RELATIONSHIP_CLOSED = 'clos'; 18 + const RELATIONSHIP_UNOWNED = 'unow'; 17 19 18 20 }